X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmbsstr.c;h=a3ac200507fffa013d14588bf638150afa4c8092;hb=7ef6c64e210ac0979d7e8ac69bc5b5208c2405ab;hp=f84e689e4c98f28787bc63bf59b1f2cb2558f7be;hpb=9fc81090f6c5590bd1b0e0fa5087577a2ee43a3e;p=gnulib.git diff --git a/lib/mbsstr.c b/lib/mbsstr.c index f84e689e4..a3ac20050 100644 --- a/lib/mbsstr.c +++ b/lib/mbsstr.c @@ -1,5 +1,5 @@ /* Searching in a string. - Copyright (C) 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2014 Free Software Foundation, Inc. Written by Bruno Haible , 2005. This program is free software: you can redistribute it and/or modify @@ -45,11 +45,12 @@ knuth_morris_pratt_multibyte (const char *haystack, const char *needle, size_t *table; /* Allocate room for needle_mbchars and the table. */ - char *memory = (char *) nmalloca (m, sizeof (mbchar_t) + sizeof (size_t)); + void *memory = nmalloca (m, sizeof (mbchar_t) + sizeof (size_t)); + void *table_memory; if (memory == NULL) return false; - needle_mbchars = (mbchar_t *) memory; - table = (size_t *) (memory + m * sizeof (mbchar_t)); + needle_mbchars = memory; + table = table_memory = needle_mbchars + m; /* Fill needle_mbchars. */ {