Show More
@@ -50,6 +50,22 b' void debugmsg(const char *fmt, ...)' | |||||
50 | va_end(args); |
|
50 | va_end(args); | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
|
53 | void *mallocx(size_t size) | |||
|
54 | { | |||
|
55 | void *result = malloc(size); | |||
|
56 | if (!result) | |||
|
57 | abortmsg("failed to malloc"); | |||
|
58 | return result; | |||
|
59 | } | |||
|
60 | ||||
|
61 | void *reallocx(void *ptr, size_t size) | |||
|
62 | { | |||
|
63 | void *result = realloc(ptr, size); | |||
|
64 | if (!result) | |||
|
65 | abortmsg("failed to realloc"); | |||
|
66 | return result; | |||
|
67 | } | |||
|
68 | ||||
53 | /* |
|
69 | /* | |
54 | * Execute a shell command in mostly the same manner as system(), with the |
|
70 | * Execute a shell command in mostly the same manner as system(), with the | |
55 | * give environment variables, after chdir to the given cwd. Returns a status |
|
71 | * give environment variables, after chdir to the given cwd. Returns a status |
@@ -19,6 +19,9 b' void abortmsg(const char *fmt, ...) PRIN' | |||||
19 | void enabledebugmsg(void); |
|
19 | void enabledebugmsg(void); | |
20 | void debugmsg(const char *fmt, ...) PRINTF_FORMAT_; |
|
20 | void debugmsg(const char *fmt, ...) PRINTF_FORMAT_; | |
21 |
|
21 | |||
|
22 | void *mallocx(size_t size); | |||
|
23 | void *reallocx(void *ptr, size_t size); | |||
|
24 | ||||
22 | int runshellcmd(const char *cmd, const char *envp[], const char *cwd); |
|
25 | int runshellcmd(const char *cmd, const char *envp[], const char *cwd); | |
23 |
|
26 | |||
24 | #endif /* UTIL_H_ */ |
|
27 | #endif /* UTIL_H_ */ |
General Comments 0
You need to be logged in to leave comments.
Login now