Commit 1aa36b48 authored by Simon McVittie's avatar Simon McVittie

Revert "Rename function string_array_length() to _dbus_string_array_length()...

Revert "Rename function string_array_length() to _dbus_string_array_length() and move it to dbus-internals.c."

This reverts commit 1370b440.
This change was intended for 1.11.
parent 554dba97
...@@ -641,21 +641,6 @@ _dbus_string_array_contains (const char **array, ...@@ -641,21 +641,6 @@ _dbus_string_array_contains (const char **array,
return FALSE; return FALSE;
} }
/**
* Returns the size of a string array
*
* @param array array to search.
* @returns size of array
*/
size_t
_dbus_string_array_length (const char **array)
{
size_t i;
for (i = 0; array[i]; i++) {}
return i;
}
/** /**
* Generates a new UUID. If you change how this is done, * Generates a new UUID. If you change how this is done,
* there's some text about it in the spec that should also change. * there's some text about it in the spec that should also change.
......
...@@ -246,8 +246,6 @@ void* _dbus_memdup (const void *mem, ...@@ -246,8 +246,6 @@ void* _dbus_memdup (const void *mem,
DBUS_PRIVATE_EXPORT DBUS_PRIVATE_EXPORT
dbus_bool_t _dbus_string_array_contains (const char **array, dbus_bool_t _dbus_string_array_contains (const char **array,
const char *str); const char *str);
DBUS_PRIVATE_EXPORT
size_t _dbus_string_array_length (const char **array);
char** _dbus_dup_string_array (const char **array); char** _dbus_dup_string_array (const char **array);
#define _DBUS_INT16_MIN ((dbus_int16_t) 0x8000) #define _DBUS_INT16_MIN ((dbus_int16_t) 0x8000)
......
...@@ -1592,6 +1592,14 @@ do_test_dispatch (DBusObjectTree *tree, ...@@ -1592,6 +1592,14 @@ do_test_dispatch (DBusObjectTree *tree,
return FALSE; return FALSE;
} }
static size_t
string_array_length (const char **array)
{
size_t i;
for (i = 0; array[i]; i++) ;
return i;
}
typedef struct typedef struct
{ {
const char *path; const char *path;
...@@ -1626,14 +1634,14 @@ run_decompose_tests (void) ...@@ -1626,14 +1634,14 @@ run_decompose_tests (void)
&result, &result_len)) &result, &result_len))
return FALSE; return FALSE;
expected_len = _dbus_string_array_length (decompose_tests[i].result); expected_len = string_array_length (decompose_tests[i].result);
if (result_len != (int) _dbus_string_array_length ((const char**)result) || if (result_len != (int) string_array_length ((const char**)result) ||
expected_len != result_len || expected_len != result_len ||
path_contains (decompose_tests[i].result, path_contains (decompose_tests[i].result,
(const char**) result) != STR_EQUAL) (const char**) result) != STR_EQUAL)
{ {
int real_len = _dbus_string_array_length ((const char**)result); int real_len = string_array_length ((const char**)result);
_dbus_warn ("Expected decompose of %s to have len %d, returned %d, appears to have %d\n", _dbus_warn ("Expected decompose of %s to have len %d, returned %d, appears to have %d\n",
decompose_tests[i].path, expected_len, result_len, decompose_tests[i].path, expected_len, result_len,
real_len); real_len);
...@@ -1867,7 +1875,7 @@ object_tree_test_iteration (void *data) ...@@ -1867,7 +1875,7 @@ object_tree_test_iteration (void *data)
_dbus_object_tree_list_registered_unlocked (tree, path1, &child_entries); _dbus_object_tree_list_registered_unlocked (tree, path1, &child_entries);
if (child_entries != NULL) if (child_entries != NULL)
{ {
nb = _dbus_string_array_length ((const char**)child_entries); nb = string_array_length ((const char**)child_entries);
_dbus_assert (nb == 1); _dbus_assert (nb == 1);
dbus_free_string_array (child_entries); dbus_free_string_array (child_entries);
} }
...@@ -1875,7 +1883,7 @@ object_tree_test_iteration (void *data) ...@@ -1875,7 +1883,7 @@ object_tree_test_iteration (void *data)
_dbus_object_tree_list_registered_unlocked (tree, path2, &child_entries); _dbus_object_tree_list_registered_unlocked (tree, path2, &child_entries);
if (child_entries != NULL) if (child_entries != NULL)
{ {
nb = _dbus_string_array_length ((const char**)child_entries); nb = string_array_length ((const char**)child_entries);
_dbus_assert (nb == 2); _dbus_assert (nb == 2);
dbus_free_string_array (child_entries); dbus_free_string_array (child_entries);
} }
...@@ -1883,7 +1891,7 @@ object_tree_test_iteration (void *data) ...@@ -1883,7 +1891,7 @@ object_tree_test_iteration (void *data)
_dbus_object_tree_list_registered_unlocked (tree, path8, &child_entries); _dbus_object_tree_list_registered_unlocked (tree, path8, &child_entries);
if (child_entries != NULL) if (child_entries != NULL)
{ {
nb = _dbus_string_array_length ((const char**)child_entries); nb = string_array_length ((const char**)child_entries);
_dbus_assert (nb == 0); _dbus_assert (nb == 0);
dbus_free_string_array (child_entries); dbus_free_string_array (child_entries);
} }
...@@ -1891,7 +1899,7 @@ object_tree_test_iteration (void *data) ...@@ -1891,7 +1899,7 @@ object_tree_test_iteration (void *data)
_dbus_object_tree_list_registered_unlocked (tree, root, &child_entries); _dbus_object_tree_list_registered_unlocked (tree, root, &child_entries);
if (child_entries != NULL) if (child_entries != NULL)
{ {
nb = _dbus_string_array_length ((const char**)child_entries); nb = string_array_length ((const char**)child_entries);
_dbus_assert (nb == 3); _dbus_assert (nb == 3);
dbus_free_string_array (child_entries); dbus_free_string_array (child_entries);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment