X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmbsstr.c;h=1876e6e78429b4e3642536375842ea1c45c06712;hb=5d95b32a83f1663be6172f07b21ba7615b6055f4;hp=f28311815638a8335cea3e4bbd2992ca635355a2;hpb=69f441a727eb38c7bff8bb1ca3cbd90dfc1cb0ae;p=gnulib.git diff --git a/lib/mbsstr.c b/lib/mbsstr.c index f28311815..1876e6e78 100644 --- a/lib/mbsstr.c +++ b/lib/mbsstr.c @@ -24,6 +24,7 @@ #include #include /* for NULL, in case a nonstandard string.h lacks it */ +#include "allocsa.h" #if HAVE_MBRTOWC # include "mbuiter.h" #endif @@ -39,7 +40,7 @@ knuth_morris_pratt_unibyte (const char *haystack, const char *needle, size_t m = strlen (needle); /* Allocate the table. */ - size_t *table = (size_t *) malloc (m * sizeof (size_t)); + size_t *table = (size_t *) allocsa (m * sizeof (size_t)); if (table == NULL) return false; /* Fill the table. @@ -113,7 +114,7 @@ knuth_morris_pratt_unibyte (const char *haystack, const char *needle, } } - free (table); + freesa (table); return true; } @@ -127,7 +128,7 @@ knuth_morris_pratt_multibyte (const char *haystack, const char *needle, size_t *table; /* Allocate room for needle_mbchars and the table. */ - char *memory = (char *) malloc (m * (sizeof (mbchar_t) + sizeof (size_t))); + char *memory = (char *) allocsa (m * (sizeof (mbchar_t) + sizeof (size_t))); if (memory == NULL) return false; needle_mbchars = (mbchar_t *) memory; @@ -222,7 +223,7 @@ knuth_morris_pratt_multibyte (const char *haystack, const char *needle, } } - free (memory); + freesa (memory); return true; } #endif