Mercurial > ~dholland > hg > tradcpp > index.cgi
comparison utils.c @ 143:ed45f2d8d3bc
Don't use the <err.h> functions.
There are still people out there using legacy systems that are missing
them.
author | David A. Holland |
---|---|
date | Sat, 13 Jul 2013 12:47:20 -0400 (2013-07-13) |
parents | 60184aa42604 |
children | d6e6b3940780 |
comparison
equal
deleted
inserted
replaced
142:26ee741196d1 | 143:ed45f2d8d3bc |
---|---|
28 */ | 28 */ |
29 | 29 |
30 #include <stdlib.h> | 30 #include <stdlib.h> |
31 #include <string.h> | 31 #include <string.h> |
32 #include <assert.h> | 32 #include <assert.h> |
33 #include <err.h> | |
34 | 33 |
35 #include "utils.h" | 34 #include "utils.h" |
36 | 35 |
37 #define MALLOCDEBUG | 36 #define MALLOCDEBUG |
38 | 37 |
123 size_t blocklen; | 122 size_t blocklen; |
124 | 123 |
125 blocklen = adjustsize(len); | 124 blocklen = adjustsize(len); |
126 ret = malloc(blocklen); | 125 ret = malloc(blocklen); |
127 if (ret == NULL) { | 126 if (ret == NULL) { |
128 warnx("Out of memory"); | 127 complain(NULL, "Out of memory"); |
129 die(); | 128 die(); |
130 } | 129 } |
131 | 130 |
132 return placeheaders(ret, len); | 131 return placeheaders(ret, len); |
133 } | 132 } |
142 blockptr = checkheaders(ptr, oldlen); | 141 blockptr = checkheaders(ptr, oldlen); |
143 newblocklen = adjustsize(newlen); | 142 newblocklen = adjustsize(newlen); |
144 | 143 |
145 ret = realloc(blockptr, newblocklen); | 144 ret = realloc(blockptr, newblocklen); |
146 if (ret == NULL) { | 145 if (ret == NULL) { |
147 warnx("Out of memory"); | 146 complain(NULL, "Out of memory"); |
148 die(); | 147 die(); |
149 } | 148 } |
150 | 149 |
151 return placeheaders(ret, newlen); | 150 return placeheaders(ret, newlen); |
152 } | 151 } |