1
2
Fork
You've already forked str
1

Fix: off by one in str_strip_postfix #4

Merged
rubiefawn merged 1 commit from :fix/str-strip-postfix into main 2026年05月04日 10:27:09 +02:00
Contributor
Copy link

str_strip_postfix_str and str_strip_postfix_cstr were comparing one byte too early

test: test.c:38: main: Assertion `str_eq(str_strip_postfix(str_from_cstr("ok!"), str_from_cstr("!")), str_from_cstr("ok"))' failed.
zsh: IOT instruction (core dumped) ./bin/test

remove both -1 to fix this

str_strip_postfix_str and str_strip_postfix_cstr were comparing one byte too early test: test.c:38: main: Assertion `str_eq(str_strip_postfix(str_from_cstr("ok!"), str_from_cstr("!")), str_from_cstr("ok"))' failed. zsh: IOT instruction (core dumped) ./bin/test remove both -1 to fix this
Fix compatiblity with earlier C standards
All checks were successful
Publish documentation / publish (push) Successful in 24s
2e46425606
- Use NULL rather than C23's nullptr
- Omit _Generic macros when compiling with < C11
- Remove the attributes I just added, attributes are a C23 feature
- Add -std=c17 to the test binary specifically
- Exclude strdup() polyfill when compiling with MSVC
I really like C23, but there's no point in polyfilling C23 features if
C23 is required to use the polyfill lmao
ehatch force-pushed fix/str-strip-postfix from 76b56f74a6 to 11639afa72 2026年05月04日 10:01:49 +02:00 Compare
ehatch force-pushed fix/str-strip-postfix from 11639afa72 to 112e0e5daa
All checks were successful
Publish documentation / publish (push) Successful in 56s
2026年05月04日 10:07:18 +02:00
Compare
ehatch deleted branch fix/str-strip-postfix 2026年05月08日 10:03:04 +02:00
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rubiefawn/str!4
Reference in a new issue
rubiefawn/str
No description provided.
Delete branch ":fix/str-strip-postfix"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?