Add missing const. (g_strsplit): Add g_return_val_if_fail for case of

* glib/gstrfuncs.c: (g_ascii_strdown), (g_ascii_strup): Add
	missing const.
	(g_strsplit): Add g_return_val_if_fail for case of empty
	delimiter, which can result in an infinite loop otherwise.
	* glib/gstrfuncs.h: Add missing const.
	* tests/.cvsignore: Ignore a generated file.

	* tests/array-test.c:
	* tests/dirname-test.c:
	* tests/hash-test.c:
	* tests/list-test.c:
	* tests/node-test.c:
	* tests/relation-test.c:
	* tests/shell-test.c:
	* tests/slist-test.c:
	* tests/spawn-test.c:
	* tests/strfunc-test.c:
	* tests/string-test.c:
	* tests/testglib.c:
	* tests/tree-test.c:
	* tests/type-test.c:
	Add an #undef G_DISABLE_ASSERT so all tests will assert even if
	asserts are disabled inside glib itself.
This commit is contained in:
Darin Adler
2001-07-19 20:07:41 +00:00
parent f9a6307e06
commit 3fa620d4df
27 changed files with 246 additions and 10 deletions

View File

@@ -1,3 +1,29 @@
2001-07-19 Darin Adler <darin@bentspoon.com>
* glib/gstrfuncs.c: (g_ascii_strdown), (g_ascii_strup): Add
missing const.
(g_strsplit): Add g_return_val_if_fail for case of empty
delimiter, which can result in an infinite loop otherwise.
* glib/gstrfuncs.h: Add missing const.
* tests/.cvsignore: Ignore a generated file.
* tests/array-test.c:
* tests/dirname-test.c:
* tests/hash-test.c:
* tests/list-test.c:
* tests/node-test.c:
* tests/relation-test.c:
* tests/shell-test.c:
* tests/slist-test.c:
* tests/spawn-test.c:
* tests/strfunc-test.c:
* tests/string-test.c:
* tests/testglib.c:
* tests/tree-test.c:
* tests/type-test.c:
Add an #undef G_DISABLE_ASSERT so all tests will assert even if
asserts are disabled inside glib itself.
Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com> Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstring.c (g_string_insert/append/prepend_unichar): * glib/gstring.c (g_string_insert/append/prepend_unichar):

View File

@@ -1,3 +1,29 @@
2001-07-19 Darin Adler <darin@bentspoon.com>
* glib/gstrfuncs.c: (g_ascii_strdown), (g_ascii_strup): Add
missing const.
(g_strsplit): Add g_return_val_if_fail for case of empty
delimiter, which can result in an infinite loop otherwise.
* glib/gstrfuncs.h: Add missing const.
* tests/.cvsignore: Ignore a generated file.
* tests/array-test.c:
* tests/dirname-test.c:
* tests/hash-test.c:
* tests/list-test.c:
* tests/node-test.c:
* tests/relation-test.c:
* tests/shell-test.c:
* tests/slist-test.c:
* tests/spawn-test.c:
* tests/strfunc-test.c:
* tests/string-test.c:
* tests/testglib.c:
* tests/tree-test.c:
* tests/type-test.c:
Add an #undef G_DISABLE_ASSERT so all tests will assert even if
asserts are disabled inside glib itself.
Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com> Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstring.c (g_string_insert/append/prepend_unichar): * glib/gstring.c (g_string_insert/append/prepend_unichar):

View File

@@ -1,3 +1,29 @@
2001-07-19 Darin Adler <darin@bentspoon.com>
* glib/gstrfuncs.c: (g_ascii_strdown), (g_ascii_strup): Add
missing const.
(g_strsplit): Add g_return_val_if_fail for case of empty
delimiter, which can result in an infinite loop otherwise.
* glib/gstrfuncs.h: Add missing const.
* tests/.cvsignore: Ignore a generated file.
* tests/array-test.c:
* tests/dirname-test.c:
* tests/hash-test.c:
* tests/list-test.c:
* tests/node-test.c:
* tests/relation-test.c:
* tests/shell-test.c:
* tests/slist-test.c:
* tests/spawn-test.c:
* tests/strfunc-test.c:
* tests/string-test.c:
* tests/testglib.c:
* tests/tree-test.c:
* tests/type-test.c:
Add an #undef G_DISABLE_ASSERT so all tests will assert even if
asserts are disabled inside glib itself.
Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com> Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstring.c (g_string_insert/append/prepend_unichar): * glib/gstring.c (g_string_insert/append/prepend_unichar):

View File

@@ -1,3 +1,29 @@
2001-07-19 Darin Adler <darin@bentspoon.com>
* glib/gstrfuncs.c: (g_ascii_strdown), (g_ascii_strup): Add
missing const.
(g_strsplit): Add g_return_val_if_fail for case of empty
delimiter, which can result in an infinite loop otherwise.
* glib/gstrfuncs.h: Add missing const.
* tests/.cvsignore: Ignore a generated file.
* tests/array-test.c:
* tests/dirname-test.c:
* tests/hash-test.c:
* tests/list-test.c:
* tests/node-test.c:
* tests/relation-test.c:
* tests/shell-test.c:
* tests/slist-test.c:
* tests/spawn-test.c:
* tests/strfunc-test.c:
* tests/string-test.c:
* tests/testglib.c:
* tests/tree-test.c:
* tests/type-test.c:
Add an #undef G_DISABLE_ASSERT so all tests will assert even if
asserts are disabled inside glib itself.
Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com> Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstring.c (g_string_insert/append/prepend_unichar): * glib/gstring.c (g_string_insert/append/prepend_unichar):

View File

@@ -1,3 +1,29 @@
2001-07-19 Darin Adler <darin@bentspoon.com>
* glib/gstrfuncs.c: (g_ascii_strdown), (g_ascii_strup): Add
missing const.
(g_strsplit): Add g_return_val_if_fail for case of empty
delimiter, which can result in an infinite loop otherwise.
* glib/gstrfuncs.h: Add missing const.
* tests/.cvsignore: Ignore a generated file.
* tests/array-test.c:
* tests/dirname-test.c:
* tests/hash-test.c:
* tests/list-test.c:
* tests/node-test.c:
* tests/relation-test.c:
* tests/shell-test.c:
* tests/slist-test.c:
* tests/spawn-test.c:
* tests/strfunc-test.c:
* tests/string-test.c:
* tests/testglib.c:
* tests/tree-test.c:
* tests/type-test.c:
Add an #undef G_DISABLE_ASSERT so all tests will assert even if
asserts are disabled inside glib itself.
Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com> Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstring.c (g_string_insert/append/prepend_unichar): * glib/gstring.c (g_string_insert/append/prepend_unichar):

View File

@@ -1,3 +1,29 @@
2001-07-19 Darin Adler <darin@bentspoon.com>
* glib/gstrfuncs.c: (g_ascii_strdown), (g_ascii_strup): Add
missing const.
(g_strsplit): Add g_return_val_if_fail for case of empty
delimiter, which can result in an infinite loop otherwise.
* glib/gstrfuncs.h: Add missing const.
* tests/.cvsignore: Ignore a generated file.
* tests/array-test.c:
* tests/dirname-test.c:
* tests/hash-test.c:
* tests/list-test.c:
* tests/node-test.c:
* tests/relation-test.c:
* tests/shell-test.c:
* tests/slist-test.c:
* tests/spawn-test.c:
* tests/strfunc-test.c:
* tests/string-test.c:
* tests/testglib.c:
* tests/tree-test.c:
* tests/type-test.c:
Add an #undef G_DISABLE_ASSERT so all tests will assert even if
asserts are disabled inside glib itself.
Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com> Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstring.c (g_string_insert/append/prepend_unichar): * glib/gstring.c (g_string_insert/append/prepend_unichar):

View File

@@ -1,3 +1,29 @@
2001-07-19 Darin Adler <darin@bentspoon.com>
* glib/gstrfuncs.c: (g_ascii_strdown), (g_ascii_strup): Add
missing const.
(g_strsplit): Add g_return_val_if_fail for case of empty
delimiter, which can result in an infinite loop otherwise.
* glib/gstrfuncs.h: Add missing const.
* tests/.cvsignore: Ignore a generated file.
* tests/array-test.c:
* tests/dirname-test.c:
* tests/hash-test.c:
* tests/list-test.c:
* tests/node-test.c:
* tests/relation-test.c:
* tests/shell-test.c:
* tests/slist-test.c:
* tests/spawn-test.c:
* tests/strfunc-test.c:
* tests/string-test.c:
* tests/testglib.c:
* tests/tree-test.c:
* tests/type-test.c:
Add an #undef G_DISABLE_ASSERT so all tests will assert even if
asserts are disabled inside glib itself.
Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com> Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstring.c (g_string_insert/append/prepend_unichar): * glib/gstring.c (g_string_insert/append/prepend_unichar):

View File

@@ -1,3 +1,29 @@
2001-07-19 Darin Adler <darin@bentspoon.com>
* glib/gstrfuncs.c: (g_ascii_strdown), (g_ascii_strup): Add
missing const.
(g_strsplit): Add g_return_val_if_fail for case of empty
delimiter, which can result in an infinite loop otherwise.
* glib/gstrfuncs.h: Add missing const.
* tests/.cvsignore: Ignore a generated file.
* tests/array-test.c:
* tests/dirname-test.c:
* tests/hash-test.c:
* tests/list-test.c:
* tests/node-test.c:
* tests/relation-test.c:
* tests/shell-test.c:
* tests/slist-test.c:
* tests/spawn-test.c:
* tests/strfunc-test.c:
* tests/string-test.c:
* tests/testglib.c:
* tests/tree-test.c:
* tests/type-test.c:
Add an #undef G_DISABLE_ASSERT so all tests will assert even if
asserts are disabled inside glib itself.
Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com> Fri Jul 13 19:20:06 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstring.c (g_string_insert/append/prepend_unichar): * glib/gstring.c (g_string_insert/append/prepend_unichar):

View File

@@ -1,3 +1,9 @@
2001-07-19 Darin Adler <darin@bentspoon.com>
reviewed by: <delete if not using a buddy>
* glib/tmpl/string_utils.sgml:
2001-06-03 Matthias Clasen <matthiasc@poet.de> 2001-06-03 Matthias Clasen <matthiasc@poet.de>
* glib/tmpl/caches.sgml, glib/tmpl/main.sgml, * glib/tmpl/caches.sgml, glib/tmpl/main.sgml,

View File

@@ -359,17 +359,19 @@ nesting such as g_strup (g_strcanon (str)).
<!-- ##### FUNCTION g_strsplit ##### --> <!-- ##### FUNCTION g_strsplit ##### -->
<para> <para>
Splits a string into a maximum of @max_tokens pieces, using the given Splits a string into a maximum of @max_tokens pieces, using the given
@delimiter. If @max_tokens is reached, the final string in the returned @delimiter. If @max_tokens is reached, the last piece contains the
string array contains the remainder of @string. remainder of @string. If @string is an empty string, then the resulting
string array has no elements.
</para> </para>
@string: a string to split. @string: a string to split.
@delimiter: a string which specifies the places at which to split the string. @delimiter: a string which specifies the places at which to split the string.
The delimiter is not included in any of the resulting strings, unless The delimiter is not included in any of the resulting strings, unless
max_tokens is reached. max_tokens is reached.
@max_tokens: the maximum number of strings to split @string into. If this is @max_tokens: the maximum number of pieces to split @string into. If this is
less than 1, the string is split completely. less than 1, the string is split completely.
@Returns: a newly-allocated array of strings. Use g_strfreev() to free it. @Returns: a newly-allocated NULL-terminated array of strings. Use g_strfreev()
to free it.
<!-- ##### FUNCTION g_strfreev ##### --> <!-- ##### FUNCTION g_strfreev ##### -->

View File

@@ -971,10 +971,12 @@ g_strlcat (gchar *dest,
* *
* Return value: a newly allocated string, with all the upper case * Return value: a newly allocated string, with all the upper case
* characters in @string converted to lower case, with * characters in @string converted to lower case, with
* semantics that exactly match g_ascii_tolower. * semantics that exactly match g_ascii_tolower. (Note
* that this is unlike the old g_strdown, which modified
* the string in place.)
**/ **/
gchar* gchar*
g_ascii_strdown (gchar *string) g_ascii_strdown (const gchar *string)
{ {
gchar *result, *s; gchar *result, *s;
@@ -995,10 +997,12 @@ g_ascii_strdown (gchar *string)
* *
* Return value: a newly allocated string, with all the lower case * Return value: a newly allocated string, with all the lower case
* characters in @string converted to upper case, with * characters in @string converted to upper case, with
* semantics that exactly match g_ascii_toupper. * semantics that exactly match g_ascii_toupper. (Note
* that this is unlike the old g_strup, which modified
* the string in place.)
**/ **/
gchar* gchar*
g_ascii_strup (gchar *string) g_ascii_strup (const gchar *string)
{ {
gchar *result, *s; gchar *result, *s;
@@ -1573,6 +1577,7 @@ g_strsplit (const gchar *string,
g_return_val_if_fail (string != NULL, NULL); g_return_val_if_fail (string != NULL, NULL);
g_return_val_if_fail (delimiter != NULL, NULL); g_return_val_if_fail (delimiter != NULL, NULL);
g_return_val_if_fail (delimiter[0] != '\0', NULL);
if (max_tokens < 1) if (max_tokens < 1)
max_tokens = G_MAXINT; max_tokens = G_MAXINT;

View File

@@ -82,8 +82,8 @@ gint g_ascii_strcasecmp (const gchar *s1,
gint g_ascii_strncasecmp (const gchar *s1, gint g_ascii_strncasecmp (const gchar *s1,
const gchar *s2, const gchar *s2,
guint n); guint n);
gchar* g_ascii_strdown (gchar *string); gchar* g_ascii_strdown (const gchar *string);
gchar* g_ascii_strup (gchar *string); gchar* g_ascii_strup (const gchar *string);
#ifndef G_DISABLE_DEPRECATED #ifndef G_DISABLE_DEPRECATED

View File

@@ -17,6 +17,7 @@ cxx-test
date-test date-test
dirname-test dirname-test
hash-test hash-test
iochannel-test
list-test list-test
mainloop-test mainloop-test
markup-test markup-test

View File

@@ -24,6 +24,7 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/. * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#include <stdio.h> #include <stdio.h>

View File

@@ -24,6 +24,7 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/. * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#include <stdio.h> #include <stdio.h>

View File

@@ -25,6 +25,7 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/. * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H

View File

@@ -24,6 +24,7 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/. * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#include <stdio.h> #include <stdio.h>

View File

@@ -24,6 +24,7 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/. * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H

View File

@@ -24,6 +24,7 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/. * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#include <stdio.h> #include <stdio.h>

View File

@@ -24,6 +24,7 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/. * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#include <glib.h> #include <glib.h>

View File

@@ -24,6 +24,7 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/. * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#include <stdio.h> #include <stdio.h>

View File

@@ -24,6 +24,7 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/. * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#include <glib.h> #include <glib.h>

View File

@@ -24,6 +24,7 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/. * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#include <stdio.h> #include <stdio.h>

View File

@@ -24,6 +24,7 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/. * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#include <stdio.h> #include <stdio.h>

View File

@@ -26,6 +26,7 @@
#include "config.h" #include "config.h"
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#ifdef GLIB_COMPILATION #ifdef GLIB_COMPILATION

View File

@@ -24,6 +24,7 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/. * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#include <stdio.h> #include <stdio.h>

View File

@@ -24,6 +24,7 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/. * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#include <stdio.h> #include <stdio.h>