diff options
Diffstat (limited to 'src/glib-utils.c')
-rw-r--r-- | src/glib-utils.c | 139 |
1 files changed, 0 insertions, 139 deletions
diff --git a/src/glib-utils.c b/src/glib-utils.c index 9768627..57298e4 100644 --- a/src/glib-utils.c +++ b/src/glib-utils.c @@ -35,16 +35,6 @@ /* gobject utils*/ -gpointer -_g_object_ref (gpointer object) -{ - if (object != NULL) - return g_object_ref (object); - else - return NULL; -} - - void _g_object_unref (gpointer object) { @@ -185,14 +175,6 @@ escape_str (const char *str, } -/* escape with backslash the file name. */ -char* -shell_escape (const char *filename) -{ - return escape_str (filename, "$'`\"\\!?* ()[]&|:;<>#"); -} - - static const char * g_utf8_strstr (const char *haystack, const char *needle) { @@ -407,34 +389,6 @@ search_util_get_regexps (const char *pattern_string, } -char * -_g_strdup_with_max_size (const char *s, - int max_size) -{ - char *result; - int l = strlen (s); - - if (l > max_size) { - char *first_half; - char *second_half; - int offset; - int half_max_size = max_size / 2 + 1; - - first_half = g_strndup (s, half_max_size); - offset = half_max_size + l - max_size; - second_half = g_strndup (s + offset, half_max_size); - - result = g_strconcat (first_half, "...", second_half, NULL); - - g_free (first_half); - g_free (second_half); - } else - result = g_strdup (s); - - return result; -} - - const char * eat_spaces (const char *line) { @@ -446,17 +400,6 @@ eat_spaces (const char *line) } -const char * -eat_void_chars (const char *line) -{ - if (line == NULL) - return NULL; - while (((*line == ' ') || (*line == '\t')) && (*line != 0)) - line++; - return line; -} - - char ** split_line (const char *line, int n_fields) @@ -557,45 +500,6 @@ g_ptr_array_free_full (GPtrArray *array, } -void -g_ptr_array_reverse (GPtrArray *array) -{ - int i, j; - gpointer tmp; - - for (i = 0; i < array->len / 2; i++) { - j = array->len - i - 1; - tmp = g_ptr_array_index (array, i); - g_ptr_array_index (array, i) = g_ptr_array_index (array, j); - g_ptr_array_index (array, j) = tmp; - } -} - - -int -g_ptr_array_binary_search (GPtrArray *array, - gpointer value, - GCompareFunc func) -{ - int l, r, p, cmp = -1; - - l = 0; - r = array->len; - while (l < r) { - p = l + ((r - l) / 2); - cmp = func(value, &g_ptr_array_index (array, p)); - if (cmp == 0) - return p; - else if (cmp < 0) - r = p; - else - l = p + 1; - } - - return -1; -} - - GHashTable *static_strings = NULL; @@ -634,49 +538,6 @@ g_uri_display_basename (const char *uri) } -char ** -_g_strv_prepend (char **str_array, - const char *str) -{ - char **result; - int i; - int j; - - result = g_new (char *, g_strv_length (str_array) + 1); - i = 0; - result[i++] = g_strdup (str); - for (j = 0; str_array[j] != NULL; j++) - result[i++] = g_strdup (str_array[j]); - result[i] = NULL; - - return result; -} - - -gboolean -_g_strv_remove (char **str_array, - const char *str) -{ - int i; - int j; - - if (str == NULL) - return FALSE; - - for (i = 0; str_array[i] != NULL; i++) - if (strcmp (str_array[i], str) == 0) - break; - - if (str_array[i] == NULL) - return FALSE; - - for (j = i; str_array[j] != NULL; j++) - str_array[j] = str_array[j + 1]; - - return TRUE; -} - - const gchar * _g_path_get_file_name (const gchar *file_name) { |