MCPcopy Create free account
hub / github.com/KDE/kdiff3 / xmalloc

Method xmalloc

src/gnudiff_xmalloc.cpp:41–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39/* Allocate N bytes of memory dynamically, with error checking. */
40
41void *
42GnuDiff::xmalloc(size_t n)
43{
44 void *p;
45
46 p = malloc(n == 0 ? 1 : n); // There are systems where malloc returns 0 for n==0.
47 if(p == nullptr)
48 xalloc_die();
49 return p;
50}
51
52/* Change the size of an allocated block of memory P to N bytes,
53 with error checking. */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected