diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-12-01 06:23:44 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-12-01 06:23:44 +0800 |
commit | be13fec34348b896b22543dd6f4693ec19d1ac02 (patch) | |
tree | 72e3a58f1d90c994669fa0caf4429a7f1abbb0db /e-util | |
parent | 2f1d55bd73336ae433a912c8fd8a19b649306ebc (diff) | |
download | gsoc2013-evolution-be13fec34348b896b22543dd6f4693ec19d1ac02.tar gsoc2013-evolution-be13fec34348b896b22543dd6f4693ec19d1ac02.tar.gz gsoc2013-evolution-be13fec34348b896b22543dd6f4693ec19d1ac02.tar.bz2 gsoc2013-evolution-be13fec34348b896b22543dd6f4693ec19d1ac02.tar.lz gsoc2013-evolution-be13fec34348b896b22543dd6f4693ec19d1ac02.tar.xz gsoc2013-evolution-be13fec34348b896b22543dd6f4693ec19d1ac02.tar.zst gsoc2013-evolution-be13fec34348b896b22543dd6f4693ec19d1ac02.zip |
Bump the version to 0.2.99.4
2000-11-30 Jeffrey Stedfast <fejj@helixcode.com>
* configure.in: Bump the version to 0.2.99.4
* gal/util/e-util.c (e_strstrcase): This should return a const
gchar *.
(e_str_make_safe): New convenience function to replace risky chars
with an underscore.
svn path=/trunk/; revision=6744
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-util.c | 19 | ||||
-rw-r--r-- | e-util/e-util.h | 6 |
2 files changed, 20 insertions, 5 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c index 9a0929c865..6965bff9ee 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -500,7 +500,7 @@ e_strsplit (const gchar *string, return str_array; } -gchar * +const gchar * e_strstrcase (const gchar *haystack, const gchar *needle) { /* find the needle in the haystack neglecting case */ @@ -515,11 +515,24 @@ e_strstrcase (const gchar *haystack, const gchar *needle) return NULL; if (len == 0) - return (char *)haystack; + return haystack; - for (ptr = (char *)haystack; *(ptr + len - 1) != '\0'; ptr++) + for (ptr = haystack; *(ptr + len - 1) != '\0'; ptr++) if (!g_strncasecmp(ptr, needle, len)) return ptr; return NULL; } + +void +e_str_make_safe (gchar *string) +{ + gchar *p; + + g_return_if_fail (string != NULL); + + for (p = string; *p; p++) { + if (!isprint ((unsigned char)*p) || strchr (" /'\"`&();|<>${}!", *p)) + *p = '_'; + } +} diff --git a/e-util/e-util.h b/e-util/e-util.h index 7f61295d9a..37dcf3daec 100644 --- a/e-util/e-util.h +++ b/e-util/e-util.h @@ -48,8 +48,10 @@ gchar **e_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens); -gchar *e_strstrcase (const gchar *haystack, - const gchar *needle); +const gchar *e_strstrcase (const gchar *haystack, + const gchar *needle); + +void e_str_make_safe (gchar *string); void e_marshal_INT__INT_INT_POINTER (GtkObject * object, GtkSignalFunc func, |