Replace index(3) by strchr(3) and rindex(3) by strrchr(3) because the

latter is more widely available.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13540 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2006-03-08 15:52:51 +00:00
parent 1a2bd156cf
commit 7ce02733e8
12 changed files with 34 additions and 22 deletions

View File

@ -1,3 +1,17 @@
2006-03-08 Christian Stimming <stimming@tuhh.de>
* src/core-utils/gnc-gconf-utils.c,
src/business/business-gnome/business-urls.c
src/gnome-utils/dialog-preferences.c
src/gnome-utils/gnc-currency-edit.c
src/gnome-utils/gnc-plugin-file-history.c
src/gnome-utils/gnc-main-window.c
src/gnome-utils/dialog-reset-warnings.c
src/gnome-utils/gnc-tree-view.c src/gnome/window-reconcile.c
src/app-utils/file-utils.c src/app-utils/gnc-ui-util.c : Replace
index(3) by strchr(3) and rindex(3) by strrchr(3) because the
latter is more widely available.
2006-03-07 David Hampton <hampton@employees.org>
* src/gnome-utils/gnc-splash.c: Use a font size of "smaller" when

View File

@ -181,7 +181,7 @@ gnc_find_state_file (const gchar *url,
gint i;
ENTER("url %s, guid %s", url, guid);
tmp = index(url, ':');
tmp = strchr(url, ':');
if (tmp)
url = tmp + 1;

View File

@ -189,13 +189,13 @@ gnc_extract_directory (char **dirname, const char *filename)
free(*dirname);
/* Parse out the directory. */
if ((filename == NULL) || (rindex(filename, '/') == NULL)) {
if ((filename == NULL) || (strrchr(filename, '/') == NULL)) {
*dirname = NULL;
return;
}
*dirname = g_strdup(filename);
tmp = rindex(*dirname, '/');
tmp = strrchr(*dirname, '/');
*(tmp+1) = '\0';
}

View File

@ -26,7 +26,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <strings.h> /* index() on Solaris */
#include "gnc-html.h"
#include "gnc-ui-util.h"
@ -183,7 +182,7 @@ ownerreportCB (const char *location, const char *label,
/* href="...:owner=<owner-type>:guid=<guid>[&acct=<guid>]" */
acctptr = index (location, '&');
acctptr = strchr (location, '&');
if (acctptr)
acctptr++;

View File

@ -87,14 +87,14 @@ gnc_enum_from_nick(GType type,
/* Flip '-' and '_' and try again */
alt_name = g_strdup(name);
if ((ptr = index(alt_name, '-')) != NULL) {
if ((ptr = strchr(alt_name, '-')) != NULL) {
do {
*ptr++ = '_';
} while ((ptr = index(ptr, '-')) != NULL);
} else if ((ptr = index(alt_name, '_')) != NULL) {
} while ((ptr = strchr(ptr, '-')) != NULL);
} else if ((ptr = strchr(alt_name, '_')) != NULL) {
do {
*ptr++ = '-';
} while ((ptr = index(ptr, '_')) != NULL);
} while ((ptr = strchr(ptr, '_')) != NULL);
} else {
g_free(alt_name);
return default_value;
@ -144,7 +144,7 @@ gnc_gconf_general_changed (GConfClient *client,
g_once(&gcb_init_once, gcb_init, NULL);
key = gconf_entry_get_key(entry);
key_tail = rindex(key, '/');
key_tail = strrchr(key, '/');
if (key_tail != NULL) {
key_tail++;
}

View File

@ -603,7 +603,7 @@ gnc_prefs_radio_button_user_cb (GtkRadioButton *button,
/* Copy the widget name and split into gconf key and button value parts */
key = g_strdup(gtk_widget_get_name(GTK_WIDGET(button)) + PREFIX_LEN);
button_name = rindex(key, '/');
button_name = strrchr(key, '/');
*button_name++ = '\0';
DEBUG("Radio button group %s now set to %s", key, button_name);
@ -655,7 +655,7 @@ gnc_prefs_connect_radio_button (GtkRadioButton *button)
/* Copy the widget name and split into gconf key and button name parts */
key = g_strdup(gtk_widget_get_name(GTK_WIDGET(button)) + PREFIX_LEN);
button_name = rindex(key, '/');
button_name = strrchr(key, '/');
*button_name++ = '\0';
/* Get the current value. */

View File

@ -226,7 +226,7 @@ gnc_reset_warnings_add_one (GConfEntry *entry, GtkWidget *box)
GConfSchema *schema = NULL;
ENTER(" ");
name = rindex(entry->key, '/') + 1;
name = strrchr(entry->key, '/') + 1;
schema_name = gconf_entry_get_schema_name(entry);
if (schema_name)
schema = gnc_gconf_get_schema(NULL, schema_name, NULL);

View File

@ -59,7 +59,6 @@
#include <gtk/gtk.h>
#include <string.h>
#include <strings.h> /* for index() on Solaris */
#include <ctype.h>
#include <stdio.h>
@ -294,7 +293,7 @@ gnc_currency_edit_get_currency (GNCCurrencyEdit *gce)
mnemonic = g_strdup(fullname);
g_value_unset(&value);
name = index(mnemonic, ' ');
name = strchr(mnemonic, ' ');
if (name != NULL)
*name = '\0';
commodity = gnc_commodity_table_lookup (gnc_get_current_commodities (),

View File

@ -869,7 +869,7 @@ gnc_main_window_prompt_for_save (GtkWidget *window)
filename = qof_session_get_file_path(session);
if (filename == NULL)
filename = _("<unknown>");
if ((tmp = rindex(filename, '/')) != NULL)
if ((tmp = strrchr(filename, '/')) != NULL)
filename = tmp + 1;
/*
@ -1059,7 +1059,7 @@ gnc_main_window_generate_title (GncMainWindow *window)
filename = _("<no file>");
else {
/* The Gnome HIG 2.0 recommends only the file name (no path) be used. (p15) */
ptr = rindex(filename, '/');
ptr = strrchr(filename, '/');
if (ptr != NULL)
filename = ptr+1;
}
@ -2359,7 +2359,7 @@ gnc_main_window_gconf_changed (GConfClient *client,
if (!key || !value)
return;
key_tail = rindex(key, '/');
key_tail = strrchr(key, '/');
if (key_tail != NULL)
key_tail++;
if (strcmp(key_tail, KEY_TOOLBAR_STYLE) == 0) {

View File

@ -380,7 +380,7 @@ gnc_plugin_history_list_changed (GConfClient *client,
window = GNC_MAIN_WINDOW(user_data);
fullkey = gconf_entry_get_key(entry);
key = rindex(fullkey, '/') + 1;
key = strrchr(fullkey, '/') + 1;
if (strcmp(key, HISTORY_STRING_MAXFILES) == 0) {
gnc_history_update_menus (window);
LEAVE("updated maxfiles");

View File

@ -1062,7 +1062,7 @@ gnc_tree_view_gconf_changed (GConfClient *client,
}
DEBUG("Key %s, value %p", key, value);
local = rindex(key, '/')+1;
local = strrchr(key, '/')+1;
if (strcmp(local, GCONF_KEY_SORT_COLUMN) == 0) {
gnc_tree_view_set_sort_column(view, gconf_value_get_string(value));
} else if (strcmp(local, GCONF_KEY_SORT_ORDER) == 0) {
@ -1074,7 +1074,7 @@ gnc_tree_view_gconf_changed (GConfClient *client,
* into column name and key type */
known = FALSE;
column_name = strdup(local);
type_name = rindex(column_name, '_');
type_name = strrchr(column_name, '_');
*type_name++ = '\0';
if (strcmp(type_name, GCONF_KEY_VISIBLE) == 0) {

View File

@ -1189,7 +1189,7 @@ gnc_toolbar_change_cb (GConfClient *client,
if (!key || !value)
return;
key_tail = rindex(key, '/');
key_tail = strrchr(key, '/');
if (key_tail != NULL)
key_tail++;
if (strcmp(key_tail, KEY_TOOLBAR_STYLE) == 0) {