Commit Graph

8 Commits

Author SHA1 Message Date
e288f690af Don't check if (!str) in xStrdup
This effectively reverts "Stricter strdup." 4674b4a732

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.
2016-06-02 18:30:18 +08:00
4674b4a732 Stricter strdup. 2016-05-30 12:22:22 -03:00
7d3f67e822 Revert 5c593fae42 (xCalloc)
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.
2016-03-11 10:43:31 +08:00
807640e49b Shorten the code using the err() function. 2016-02-03 12:42:25 +00:00
5c593fae42 Be stricter! 2016-02-03 02:02:30 +00:00
f87462d60e Exit on failure! 2016-02-02 16:03:00 +01:00
b54d2dde40 Check for failure in allocations. 2016-02-02 15:53:02 +01:00
a1f7f2869e Add allocation tests 2016-01-31 12:01:48 +01:00