Update VA_COPY macro to use va_copy function#3
Update VA_COPY macro to use va_copy function#3programmer-1101 wants to merge 8 commits intooffscale:masterfrom
Conversation
va_list isn't guarenteed to be a simple assignable type. In the case it's not #define VA_COPY(dest, src) (dest) = (src) produces undefined behaviour
| const char *start; | ||
|
|
||
| /* Fix assignment of targetLength. C89 requires variables to be defined at beginning of a scope */ | ||
| targetLength = strlen(target); |
There was a problem hiding this comment.
It was defined at the top of scope? - And the way I had it enabled it to be const…
There was a problem hiding this comment.
You are right change was unnecessory. sorry about that.
| char *strcasestr(const char *h, const char *n) { | ||
| const size_t l = strlen(n); | ||
| size_t l; | ||
| l = strlen(n); |
There was a problem hiding this comment.
It was defined at the top of scope? - And the way I had it enabled it to be const…
| #else | ||
| #define NUM_FORMAT "%lld" | ||
| /* Fix:- Change from C99 long long to long */ | ||
| #define NUM_FORMAT "%ld" |
There was a problem hiding this comment.
You might want to guard this behind an if c89 do lld else do ld
| @@ -1,5 +1,5 @@ | |||
| freebsd_instance: | |||
| image_family: freebsd-13-0 | |||
| image_family: freebsd-14 | |||
…ability Choose between %lld and %ld based on compiler support for long long.
…tations Major Changes: - Replace Microsoft-specific _strnicmp/_stricmp with portable C89 implementations of strncasecmp() and strcasecmp() for true cross-platform compatibility - Optimize strcasestr() - Add more error code definitions for strerrorlen_s() - Enhance jasprintf() memory safety with proper error logging - Fix HAVE_STRNCASECMP_H detection to use custom implementations on non-MSVC platforms - Performance Improvements - Eliminated dependency on Microsoft-specific functions
| @@ -1 +1,7 @@ | |||
| (Apache-2.0 OR MIT) | |||
There was a problem hiding this comment.
You posted the wrong license text, use SPDX expression
|
Would it be more portable to stop using the windows-specific _stricmp and _strnicmp in c89stringutils_string_extras.c? |
|
@programmer-1101 Who are you? - I'm a bit confused, your GitHub has nothing public except forks of two of my repos. I welcome contributions; just want to know a little bit about your intentions. What are your target platforms? - Use-cases? |
|
I’m a high school student. I’ve admire your c-multiplatform work for a while and I really admire the project. I wanted to contribute and learn I'm sorry for the buggy initial PRs. I jumped in without a deep enough understanding of architectural differences. As for my GitHub profile, I mainly write code to solve logic challenges in Competitive programming sites and only got interested in contributing to real world libraries recently. My intentions are to learn from your project. and help where I can but so far I have troubled you with buggy pull requests. I will be more careful in the future. |
|
Thanks for reaching out. Ah ok cool. I recommend waiting a fortnight—a month to be safe—before looking into c-multiplatform. Adding a bunch of new features and improving its quality esp. wrt. tests. Then what might be fun is to pick your favourite app on the AppStore / Play Store / [TV/desktop/etc.] store and replicate it. I expect 300MB app downloads to be <10MB with c-multiplatform 🚀 (but yeah just watch this space; contributions welcome but really I would recommend waiting a little longer) |
|
Once again I'm really sorry being so impatient. |
Edit c89stringutils_string_extras.c for C89 compliance.
Key Changes:
This resolves build failures on architectures (like x86_64 and PowerPC)
where va_list is an array type and cannot be assigned using '='.