+2007-02-11 Bruno Haible <bruno@clisp.org>
+
+ * lib/c-strstr.c: Include allocsa.h.
+ (knuth_morris_pratt): Use allocsa/freesa instead of malloc/free.
+ * lib/c-strcasestr.c: Include allocsa.h.
+ (knuth_morris_pratt): Use allocsa/freesa instead of malloc/free.
+ * lib/strcasestr.c: Include allocsa.h.
+ (knuth_morris_pratt): Use allocsa/freesa instead of malloc/free.
+ * lib/mbsstr.c: Include allocsa.h.
+ (knuth_morris_pratt_unibyte, knuth_morris_pratt_multibyte): Use
+ allocsa/freesa instead of malloc/free.
+ * lib/mbscasestr.c: Include allocsa.h.
+ (knuth_morris_pratt_unibyte, knuth_morris_pratt_multibyte): Use
+ allocsa/freesa instead of malloc/free.
+ * modules/c-strstr (Depends-on): Add allocsa.
+ * modules/c-strcasestr (Depends-on): Likewise.
+ * modules/strcasestr (Depends-on): Likewise.
+ * modules/mbsstr (Depends-on): Likewise.
+ * modules/mbscasestr (Depends-on): Likewise.
+
2007-02-11 Bruno Haible <bruno@clisp.org>
* lib/mbsspn.c (mbsspn): Fix bug. Remove unnecessary strlen call.
#include <stddef.h>
#include <string.h>
+#include "allocsa.h"
#include "c-ctype.h"
/* Knuth-Morris-Pratt algorithm.
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.
}
}
- free (table);
+ freesa (table);
return true;
}
#include <stdlib.h>
#include <string.h>
+#include "allocsa.h"
+
/* Knuth-Morris-Pratt algorithm.
See http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm
Return a boolean indicating success. */
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.
}
}
- free (table);
+ freesa (table);
return true;
}
#include <stdbool.h>
#include <stddef.h> /* for NULL, in case a nonstandard string.h lacks it */
+#include "allocsa.h"
#if HAVE_MBRTOWC
# include "mbuiter.h"
#endif
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.
}
}
- free (table);
+ freesa (table);
return true;
}
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;
}
}
- free (memory);
+ freesa (memory);
return true;
}
#endif
#include <stdbool.h>
#include <stddef.h> /* for NULL, in case a nonstandard string.h lacks it */
+#include "allocsa.h"
#if HAVE_MBRTOWC
# include "mbuiter.h"
#endif
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.
}
}
- free (table);
+ freesa (table);
return true;
}
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;
}
}
- free (memory);
+ freesa (memory);
return true;
}
#endif
#include <stdbool.h>
#include <stddef.h> /* for NULL, in case a nonstandard string.h lacks it */
+#include "allocsa.h"
+
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
/* Knuth-Morris-Pratt algorithm.
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.
}
}
- free (table);
+ freesa (table);
return true;
}
Depends-on:
c-ctype
stdbool
+allocsa
strnlen
configure.ac:
Depends-on:
stdbool
+allocsa
strnlen
configure.ac:
stdbool
string
mbslen
+allocsa
strnlen
configure.ac:
stdbool
string
mbslen
+allocsa
strnlen
configure.ac:
Depends-on:
string
stdbool
+allocsa
strnlen
configure.ac: