Changeset 64c9165 for text.c


Ignore:
Timestamp:
Jul 24, 2009, 12:59:23 AM (12 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
5603d72
Parents:
41c9a96
git-author:
Anders Kaseorg <andersk@mit.edu> (07/24/09 00:56:26)
git-committer:
Anders Kaseorg <andersk@mit.edu> (07/24/09 00:59:23)
Message:
stristr: Remove.

This stristr implementation had problems with Unicode: g_utf8_casefold
is allowed to change the length of the string.  It seems that several
projects get this function by copying the code of utf8_strcasestr out
of gtksourceview.  Fortunately, we no longer need it.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • text.c

    rd43edd2 r64c9165  
    225225}
    226226
    227 /* exactly like strstr but case insensitive */
    228 char *stristr(char *a, char *b)
    229 {
    230   char *x, *y;
    231   char *ret = NULL;
    232   if ((x = g_utf8_casefold(a, -1)) != NULL) {
    233     if ((y = g_utf8_casefold(b, -1)) != NULL) {
    234       ret = strstr(x, y);
    235       if (ret != NULL) {
    236         ret = ret - x + a;
    237       }
    238       g_free(y);
    239     }
    240     g_free(x);
    241   }
    242   return(ret);
    243 }
    244 
    245227/* return 1 if a string is only whitespace, otherwise 0 */
    246228int only_whitespace(char *s)
Note: See TracChangeset for help on using the changeset viewer.