[Gnucash-changes] r13540 - gnucash/trunk - Replace index(3) by
strchr(3) and rindex(3) by strrchr(3) because the
Christian Stimming
cstim at cvs.gnucash.org
Wed Mar 8 10:52:52 EST 2006
Author: cstim
Date: 2006-03-08 10:52:51 -0500 (Wed, 08 Mar 2006)
New Revision: 13540
Trac: http://svn.gnucash.org/trac/changeset/13540
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/app-utils/file-utils.c
gnucash/trunk/src/app-utils/gnc-ui-util.c
gnucash/trunk/src/business/business-gnome/business-urls.c
gnucash/trunk/src/core-utils/gnc-gconf-utils.c
gnucash/trunk/src/gnome-utils/dialog-preferences.c
gnucash/trunk/src/gnome-utils/dialog-reset-warnings.c
gnucash/trunk/src/gnome-utils/gnc-currency-edit.c
gnucash/trunk/src/gnome-utils/gnc-main-window.c
gnucash/trunk/src/gnome-utils/gnc-plugin-file-history.c
gnucash/trunk/src/gnome-utils/gnc-tree-view.c
gnucash/trunk/src/gnome/window-reconcile.c
Log:
Replace index(3) by strchr(3) and rindex(3) by strrchr(3) because the
latter is more widely available.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-03-08 06:13:28 UTC (rev 13539)
+++ gnucash/trunk/ChangeLog 2006-03-08 15:52:51 UTC (rev 13540)
@@ -1,3 +1,17 @@
+2006-03-08 Christian Stimming <stimming at 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 at employees.org>
* src/gnome-utils/gnc-splash.c: Use a font size of "smaller" when
Modified: gnucash/trunk/src/app-utils/file-utils.c
===================================================================
--- gnucash/trunk/src/app-utils/file-utils.c 2006-03-08 06:13:28 UTC (rev 13539)
+++ gnucash/trunk/src/app-utils/file-utils.c 2006-03-08 15:52:51 UTC (rev 13540)
@@ -181,7 +181,7 @@
gint i;
ENTER("url %s, guid %s", url, guid);
- tmp = index(url, ':');
+ tmp = strchr(url, ':');
if (tmp)
url = tmp + 1;
Modified: gnucash/trunk/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.c 2006-03-08 06:13:28 UTC (rev 13539)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.c 2006-03-08 15:52:51 UTC (rev 13540)
@@ -189,13 +189,13 @@
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';
}
Modified: gnucash/trunk/src/business/business-gnome/business-urls.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/business-urls.c 2006-03-08 06:13:28 UTC (rev 13539)
+++ gnucash/trunk/src/business/business-gnome/business-urls.c 2006-03-08 15:52:51 UTC (rev 13540)
@@ -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 @@
/* href="...:owner=<owner-type>:guid=<guid>[&acct=<guid>]" */
- acctptr = index (location, '&');
+ acctptr = strchr (location, '&');
if (acctptr)
acctptr++;
Modified: gnucash/trunk/src/core-utils/gnc-gconf-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gconf-utils.c 2006-03-08 06:13:28 UTC (rev 13539)
+++ gnucash/trunk/src/core-utils/gnc-gconf-utils.c 2006-03-08 15:52:51 UTC (rev 13540)
@@ -87,14 +87,14 @@
/* 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 @@
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++;
}
Modified: gnucash/trunk/src/gnome/window-reconcile.c
===================================================================
--- gnucash/trunk/src/gnome/window-reconcile.c 2006-03-08 06:13:28 UTC (rev 13539)
+++ gnucash/trunk/src/gnome/window-reconcile.c 2006-03-08 15:52:51 UTC (rev 13540)
@@ -1189,7 +1189,7 @@
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) {
Modified: gnucash/trunk/src/gnome-utils/dialog-preferences.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-preferences.c 2006-03-08 06:13:28 UTC (rev 13539)
+++ gnucash/trunk/src/gnome-utils/dialog-preferences.c 2006-03-08 15:52:51 UTC (rev 13540)
@@ -603,7 +603,7 @@
/* 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 @@
/* 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. */
Modified: gnucash/trunk/src/gnome-utils/dialog-reset-warnings.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-reset-warnings.c 2006-03-08 06:13:28 UTC (rev 13539)
+++ gnucash/trunk/src/gnome-utils/dialog-reset-warnings.c 2006-03-08 15:52:51 UTC (rev 13540)
@@ -226,7 +226,7 @@
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);
Modified: gnucash/trunk/src/gnome-utils/gnc-currency-edit.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-currency-edit.c 2006-03-08 06:13:28 UTC (rev 13539)
+++ gnucash/trunk/src/gnome-utils/gnc-currency-edit.c 2006-03-08 15:52:51 UTC (rev 13540)
@@ -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 @@
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 (),
Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c 2006-03-08 06:13:28 UTC (rev 13539)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c 2006-03-08 15:52:51 UTC (rev 13540)
@@ -869,7 +869,7 @@
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 @@
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 @@
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) {
Modified: gnucash/trunk/src/gnome-utils/gnc-plugin-file-history.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-plugin-file-history.c 2006-03-08 06:13:28 UTC (rev 13539)
+++ gnucash/trunk/src/gnome-utils/gnc-plugin-file-history.c 2006-03-08 15:52:51 UTC (rev 13540)
@@ -380,7 +380,7 @@
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");
Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view.c 2006-03-08 06:13:28 UTC (rev 13539)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view.c 2006-03-08 15:52:51 UTC (rev 13540)
@@ -1062,7 +1062,7 @@
}
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 @@
* 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) {
More information about the gnucash-changes
mailing list