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

@@ -359,17 +359,19 @@ nesting such as g_strup (g_strcanon (str)).
<!-- ##### FUNCTION g_strsplit ##### -->
<para>
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
string array contains the remainder of @string.
@delimiter. If @max_tokens is reached, the last piece contains the
remainder of @string. If @string is an empty string, then the resulting
string array has no elements.
</para>
@string: a string to split.
@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
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.
@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 ##### -->