X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;ds=sidebyside;f=sbr%2Futils.c;h=2120b84541cb77ee7d3933c00e07f6823ec90d5d;hb=8f0c973e6cfebb193010714453f70f55ceae5dd7;hp=c25e02d40bd293a52f683b33eae4f90cca43dfc1;hpb=23f854c962a161cc8ed982b23183600df376e818;p=mmh diff --git a/sbr/utils.c b/sbr/utils.c index c25e02d..2120b84 100644 --- a/sbr/utils.c +++ b/sbr/utils.c @@ -13,6 +13,9 @@ #include #include +/* + * Safely call malloc + */ void * mh_xmalloc(size_t size) { @@ -28,6 +31,9 @@ mh_xmalloc(size_t size) return memory; } +/* + * Safely call realloc + */ void * mh_xrealloc(void *ptr, size_t size) { @@ -42,6 +48,11 @@ mh_xrealloc(void *ptr, size_t size) return memory; } + +/* + * Return the present working directory, if the current directory does not + * exist, or is too long, make / the pwd. + */ char * pwd(void) {