* mymalloc * * Allocates some memory and checks if that succeeded or not. If it failed, * do some errorlogging and bail out. * * NOTE: Kenneth Lavrsen changed printing of size_t types so instead of using * conversion specifier %zd I changed it to %llu and casted the size_t * variable to unsigned long long. The reason for this nonsense is that older * versions of gcc like 2.95 u
| 193 | * Returns: a pointer to the allocated memory |
| 194 | */ |
| 195 | void *mymalloc(size_t nbytes) |
| 196 | { |
| 197 | void *dummy = calloc(nbytes, 1); |
| 198 | |
| 199 | if (!dummy) { |
| 200 | MOTION_LOG(EMG, TYPE_ALL, SHOW_ERRNO, _("Could not allocate %llu bytes of memory!") |
| 201 | ,(unsigned long long)nbytes); |
| 202 | motion_remove_pid(); |
| 203 | exit(1); |
| 204 | } |
| 205 | |
| 206 | return dummy; |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * myrealloc |
no test coverage detected