mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
1a2bd156cf
commit
7ce02733e8
14
ChangeLog
14
ChangeLog
@ -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>
|
2006-03-07 David Hampton <hampton@employees.org>
|
||||||
|
|
||||||
* src/gnome-utils/gnc-splash.c: Use a font size of "smaller" when
|
* src/gnome-utils/gnc-splash.c: Use a font size of "smaller" when
|
||||||
|
@ -181,7 +181,7 @@ gnc_find_state_file (const gchar *url,
|
|||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
ENTER("url %s, guid %s", url, guid);
|
ENTER("url %s, guid %s", url, guid);
|
||||||
tmp = index(url, ':');
|
tmp = strchr(url, ':');
|
||||||
if (tmp)
|
if (tmp)
|
||||||
url = tmp + 1;
|
url = tmp + 1;
|
||||||
|
|
||||||
|
@ -189,13 +189,13 @@ gnc_extract_directory (char **dirname, const char *filename)
|
|||||||
free(*dirname);
|
free(*dirname);
|
||||||
|
|
||||||
/* Parse out the directory. */
|
/* Parse out the directory. */
|
||||||
if ((filename == NULL) || (rindex(filename, '/') == NULL)) {
|
if ((filename == NULL) || (strrchr(filename, '/') == NULL)) {
|
||||||
*dirname = NULL;
|
*dirname = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
*dirname = g_strdup(filename);
|
*dirname = g_strdup(filename);
|
||||||
tmp = rindex(*dirname, '/');
|
tmp = strrchr(*dirname, '/');
|
||||||
*(tmp+1) = '\0';
|
*(tmp+1) = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <strings.h> /* index() on Solaris */
|
|
||||||
|
|
||||||
#include "gnc-html.h"
|
#include "gnc-html.h"
|
||||||
#include "gnc-ui-util.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>]" */
|
/* href="...:owner=<owner-type>:guid=<guid>[&acct=<guid>]" */
|
||||||
|
|
||||||
acctptr = index (location, '&');
|
acctptr = strchr (location, '&');
|
||||||
if (acctptr)
|
if (acctptr)
|
||||||
acctptr++;
|
acctptr++;
|
||||||
|
|
||||||
|
@ -87,14 +87,14 @@ gnc_enum_from_nick(GType type,
|
|||||||
|
|
||||||
/* Flip '-' and '_' and try again */
|
/* Flip '-' and '_' and try again */
|
||||||
alt_name = g_strdup(name);
|
alt_name = g_strdup(name);
|
||||||
if ((ptr = index(alt_name, '-')) != NULL) {
|
if ((ptr = strchr(alt_name, '-')) != NULL) {
|
||||||
do {
|
do {
|
||||||
*ptr++ = '_';
|
*ptr++ = '_';
|
||||||
} while ((ptr = index(ptr, '-')) != NULL);
|
} while ((ptr = strchr(ptr, '-')) != NULL);
|
||||||
} else if ((ptr = index(alt_name, '_')) != NULL) {
|
} else if ((ptr = strchr(alt_name, '_')) != NULL) {
|
||||||
do {
|
do {
|
||||||
*ptr++ = '-';
|
*ptr++ = '-';
|
||||||
} while ((ptr = index(ptr, '_')) != NULL);
|
} while ((ptr = strchr(ptr, '_')) != NULL);
|
||||||
} else {
|
} else {
|
||||||
g_free(alt_name);
|
g_free(alt_name);
|
||||||
return default_value;
|
return default_value;
|
||||||
@ -144,7 +144,7 @@ gnc_gconf_general_changed (GConfClient *client,
|
|||||||
g_once(&gcb_init_once, gcb_init, NULL);
|
g_once(&gcb_init_once, gcb_init, NULL);
|
||||||
|
|
||||||
key = gconf_entry_get_key(entry);
|
key = gconf_entry_get_key(entry);
|
||||||
key_tail = rindex(key, '/');
|
key_tail = strrchr(key, '/');
|
||||||
if (key_tail != NULL) {
|
if (key_tail != NULL) {
|
||||||
key_tail++;
|
key_tail++;
|
||||||
}
|
}
|
||||||
|
@ -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 */
|
/* 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);
|
key = g_strdup(gtk_widget_get_name(GTK_WIDGET(button)) + PREFIX_LEN);
|
||||||
button_name = rindex(key, '/');
|
button_name = strrchr(key, '/');
|
||||||
*button_name++ = '\0';
|
*button_name++ = '\0';
|
||||||
|
|
||||||
DEBUG("Radio button group %s now set to %s", key, button_name);
|
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 */
|
/* 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);
|
key = g_strdup(gtk_widget_get_name(GTK_WIDGET(button)) + PREFIX_LEN);
|
||||||
button_name = rindex(key, '/');
|
button_name = strrchr(key, '/');
|
||||||
*button_name++ = '\0';
|
*button_name++ = '\0';
|
||||||
|
|
||||||
/* Get the current value. */
|
/* Get the current value. */
|
||||||
|
@ -226,7 +226,7 @@ gnc_reset_warnings_add_one (GConfEntry *entry, GtkWidget *box)
|
|||||||
GConfSchema *schema = NULL;
|
GConfSchema *schema = NULL;
|
||||||
|
|
||||||
ENTER(" ");
|
ENTER(" ");
|
||||||
name = rindex(entry->key, '/') + 1;
|
name = strrchr(entry->key, '/') + 1;
|
||||||
schema_name = gconf_entry_get_schema_name(entry);
|
schema_name = gconf_entry_get_schema_name(entry);
|
||||||
if (schema_name)
|
if (schema_name)
|
||||||
schema = gnc_gconf_get_schema(NULL, schema_name, NULL);
|
schema = gnc_gconf_get_schema(NULL, schema_name, NULL);
|
||||||
|
@ -59,7 +59,6 @@
|
|||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h> /* for index() on Solaris */
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -294,7 +293,7 @@ gnc_currency_edit_get_currency (GNCCurrencyEdit *gce)
|
|||||||
mnemonic = g_strdup(fullname);
|
mnemonic = g_strdup(fullname);
|
||||||
g_value_unset(&value);
|
g_value_unset(&value);
|
||||||
|
|
||||||
name = index(mnemonic, ' ');
|
name = strchr(mnemonic, ' ');
|
||||||
if (name != NULL)
|
if (name != NULL)
|
||||||
*name = '\0';
|
*name = '\0';
|
||||||
commodity = gnc_commodity_table_lookup (gnc_get_current_commodities (),
|
commodity = gnc_commodity_table_lookup (gnc_get_current_commodities (),
|
||||||
|
@ -869,7 +869,7 @@ gnc_main_window_prompt_for_save (GtkWidget *window)
|
|||||||
filename = qof_session_get_file_path(session);
|
filename = qof_session_get_file_path(session);
|
||||||
if (filename == NULL)
|
if (filename == NULL)
|
||||||
filename = _("<unknown>");
|
filename = _("<unknown>");
|
||||||
if ((tmp = rindex(filename, '/')) != NULL)
|
if ((tmp = strrchr(filename, '/')) != NULL)
|
||||||
filename = tmp + 1;
|
filename = tmp + 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1059,7 +1059,7 @@ gnc_main_window_generate_title (GncMainWindow *window)
|
|||||||
filename = _("<no file>");
|
filename = _("<no file>");
|
||||||
else {
|
else {
|
||||||
/* The Gnome HIG 2.0 recommends only the file name (no path) be used. (p15) */
|
/* The Gnome HIG 2.0 recommends only the file name (no path) be used. (p15) */
|
||||||
ptr = rindex(filename, '/');
|
ptr = strrchr(filename, '/');
|
||||||
if (ptr != NULL)
|
if (ptr != NULL)
|
||||||
filename = ptr+1;
|
filename = ptr+1;
|
||||||
}
|
}
|
||||||
@ -2359,7 +2359,7 @@ gnc_main_window_gconf_changed (GConfClient *client,
|
|||||||
if (!key || !value)
|
if (!key || !value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
key_tail = rindex(key, '/');
|
key_tail = strrchr(key, '/');
|
||||||
if (key_tail != NULL)
|
if (key_tail != NULL)
|
||||||
key_tail++;
|
key_tail++;
|
||||||
if (strcmp(key_tail, KEY_TOOLBAR_STYLE) == 0) {
|
if (strcmp(key_tail, KEY_TOOLBAR_STYLE) == 0) {
|
||||||
|
@ -380,7 +380,7 @@ gnc_plugin_history_list_changed (GConfClient *client,
|
|||||||
window = GNC_MAIN_WINDOW(user_data);
|
window = GNC_MAIN_WINDOW(user_data);
|
||||||
|
|
||||||
fullkey = gconf_entry_get_key(entry);
|
fullkey = gconf_entry_get_key(entry);
|
||||||
key = rindex(fullkey, '/') + 1;
|
key = strrchr(fullkey, '/') + 1;
|
||||||
if (strcmp(key, HISTORY_STRING_MAXFILES) == 0) {
|
if (strcmp(key, HISTORY_STRING_MAXFILES) == 0) {
|
||||||
gnc_history_update_menus (window);
|
gnc_history_update_menus (window);
|
||||||
LEAVE("updated maxfiles");
|
LEAVE("updated maxfiles");
|
||||||
|
@ -1062,7 +1062,7 @@ gnc_tree_view_gconf_changed (GConfClient *client,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEBUG("Key %s, value %p", key, value);
|
DEBUG("Key %s, value %p", key, value);
|
||||||
local = rindex(key, '/')+1;
|
local = strrchr(key, '/')+1;
|
||||||
if (strcmp(local, GCONF_KEY_SORT_COLUMN) == 0) {
|
if (strcmp(local, GCONF_KEY_SORT_COLUMN) == 0) {
|
||||||
gnc_tree_view_set_sort_column(view, gconf_value_get_string(value));
|
gnc_tree_view_set_sort_column(view, gconf_value_get_string(value));
|
||||||
} else if (strcmp(local, GCONF_KEY_SORT_ORDER) == 0) {
|
} 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 */
|
* into column name and key type */
|
||||||
known = FALSE;
|
known = FALSE;
|
||||||
column_name = strdup(local);
|
column_name = strdup(local);
|
||||||
type_name = rindex(column_name, '_');
|
type_name = strrchr(column_name, '_');
|
||||||
*type_name++ = '\0';
|
*type_name++ = '\0';
|
||||||
|
|
||||||
if (strcmp(type_name, GCONF_KEY_VISIBLE) == 0) {
|
if (strcmp(type_name, GCONF_KEY_VISIBLE) == 0) {
|
||||||
|
@ -1189,7 +1189,7 @@ gnc_toolbar_change_cb (GConfClient *client,
|
|||||||
if (!key || !value)
|
if (!key || !value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
key_tail = rindex(key, '/');
|
key_tail = strrchr(key, '/');
|
||||||
if (key_tail != NULL)
|
if (key_tail != NULL)
|
||||||
key_tail++;
|
key_tail++;
|
||||||
if (strcmp(key_tail, KEY_TOOLBAR_STYLE) == 0) {
|
if (strcmp(key_tail, KEY_TOOLBAR_STYLE) == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user