summaryrefslogtreecommitdiffstats
path: root/XAlloc.c
Commit message (Collapse)AuthorAgeFilesLines
* Security review: check results of snprintf.Hisham Muhammad2017-07-271-1/+3
| | | | | Calls marked with xSnprintf shouldn't fail. Abort program cleanly if any of them does.
* Fix xStrdup debug build failure & allow Clang to use ((nonnull))Explorer092016-06-031-3/+7
|
* Add assert and __attribute__((nonnull)) on xStrdupExplorer092016-06-021-1/+14
| | | | | | | | | __attribute__((nonnull)) will help catching "calling with NULL" mistake on compile time. I also convert xStrdup into a macro, that will do assert() inline when the code is *not* built with -DNDEBUG . For release builds (with -DNDEBUG), preprocessor trick will ensure that generated code remains the same.
* Don't check if (!str) in xStrdupExplorer092016-06-021-3/+0
| | | | | | | | This effectively reverts "Stricter strdup." 4674b4a7320bb6b003a4e3b3840027573691e60d If str is NULL upon the calling of strdup(), it should crash with SIGSEGV. Just let it crash. Adding the "if (!str) fail();" code serves nothing but bloat.
* Stricter strdup.Hisham2016-05-301-1/+4
|
* Revert 5c593fae4227651075cfc9445f17dad6ae0a0b47 (xCalloc)Explorer092016-03-111-1/+1
| | | | | | | | | | calloc() allows 'nmemb' or 'size' to be zero, in which case NULL may be returned. Letting htop die because of either argument being zero doesn't make sense. As a side note: As size_t is unsigned, compiler should be able to optimize conditional (nmemb > 0 && size > 0) to (nmemb && size). This theorically shouldn't increase code size too much.
* Shorten the code using the err() function.Hisham2016-02-031-18/+11
|
* Be stricter!Hisham2016-02-031-1/+1
|
* Exit on failure!Hisham2016-02-021-0/+4
|
* Check for failure in allocations.Hisham2016-02-021-4/+4
|
* Add allocation testsHisham2016-01-311-0/+55

© 2014-2024 Faster IT GmbH | imprint | privacy policy