/[public]/getopt/trunk/xalloc.h
ViewVC logotype

Diff of /getopt/trunk/xalloc.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 322 Revision 323
20static void *xmalloc(const size_t size) 20static void *xmalloc(const size_t size)
21{ 21{
22 void *ret = malloc(size); 22 void *ret = malloc(size);
23 23
24 if (!ret && size) { 24 if (!ret && size) {
25 fprintf(stderr, "Error: cannot allocate %zu bytes", size); 25 fprintf(stderr, "%s: error: cannot allocate %zu bytes", program_invocation_short_name, size);
26 exit(XALLOC_EXIT_CODE); 26 exit(XALLOC_EXIT_CODE);
27 } 27 }
28 return ret; 28 return ret;
29} 29}
30 30
31static void *xrealloc(void *ptr, const size_t size) 31static void *xrealloc(void *ptr, const size_t size)
32{ 32{
33 void *ret = realloc(ptr, size); 33 void *ret = realloc(ptr, size);
34 34
35 if (!ret && size) 35 if (!ret && size)
36 fprintf(stderr, "Error: cannot allocate %zu bytes", size); 36 fprintf(stderr, "%s: Error: cannot allocate %zu bytes", program_invocation_short_name, size);
37 return ret; 37 return ret;
38} 38}
39 39
40#endif 40#endif

Legend:
Removed from v.322  
changed lines
  Added in v.323

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26