From: John Darrington Date: Mon, 24 Dec 2007 01:33:42 +0000 (+0000) Subject: Constness patrol X-Git-Tag: v0.6.0~152 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e22b03f96f0edbace5bce45abdc57e94cf6957c;p=pspp-builds.git Constness patrol --- diff --git a/src/data/data-in.c b/src/data/data-in.c index b9907c2d..d84b806a 100644 --- a/src/data/data-in.c +++ b/src/data/data-in.c @@ -795,7 +795,7 @@ parse_name_token (struct data_in *i) exact matches (except for case) are allowed. Returns true if successful, false otherwise. */ static bool -match_name (struct substring token, const char **names, long *output) +match_name (struct substring token, const char *const *names, long *output) { int i; @@ -824,14 +824,14 @@ parse_month (struct data_in *i, long *month) } else { - static const char *english_names[] = + static const char *const english_names[] = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec", NULL, }; - static const char *roman_names[] = + static const char *const roman_names[] = { "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix", "x", "xi", "xii", @@ -1012,7 +1012,7 @@ parse_minute_second (struct data_in *i, double *time) static bool parse_weekday (struct data_in *i, long *weekday) { - static const char *weekday_names[] = + static const char *const weekday_names[] = { "su", "mo", "tu", "we", "th", "fr", "sa", NULL, diff --git a/src/data/data-out.c b/src/data/data-out.c index 26abc7cc..6d7c9ced 100644 --- a/src/data/data-out.c +++ b/src/data/data-out.c @@ -366,7 +366,7 @@ output_date (const union value *input, const struct fmt_spec *format, p += sprintf (p, "%02d", month); else { - static const char *months[12] = + static const char *const months[12] = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC", @@ -462,7 +462,7 @@ static void output_WKDAY (const union value *input, const struct fmt_spec *format, char *output) { - static const char *weekdays[7] = + static const char *const weekdays[7] = { "SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", @@ -483,7 +483,7 @@ static void output_MONTH (const union value *input, const struct fmt_spec *format, char *output) { - static const char *months[12] = + static const char *const months[12] = { "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER", diff --git a/src/data/por-file-reader.c b/src/data/por-file-reader.c index 3f2cdd46..52c0cc8e 100644 --- a/src/data/por-file-reader.c +++ b/src/data/por-file-reader.c @@ -509,8 +509,9 @@ read_header (struct pfm_reader *r) static void read_version_data (struct pfm_reader *r, struct pfm_read_info *info) { - static char empty_string[] = ""; - char *date, *time, *product, *author, *subproduct; + static const char empty_string[] = ""; + char *date, *time; + const char *product, *author, *subproduct; int i; /* Read file. */ diff --git a/src/data/sys-file-reader.c b/src/data/sys-file-reader.c index 8b29e0a5..d71027d5 100644 --- a/src/data/sys-file-reader.c +++ b/src/data/sys-file-reader.c @@ -811,7 +811,7 @@ read_machine_integer_info (struct sfm_reader *r, size_t size, size_t count, NOT_REACHED (); if (integer_representation != expected_integer_format) { - static const char *endian[] = {N_("little-endian"), N_("big-endian")}; + static const char *const endian[] = {N_("little-endian"), N_("big-endian")}; sys_warn (r, _("Integer format indicated by system file (%s) " "differs from expected (%s)."), gettext (endian[integer_representation == 1]), diff --git a/src/data/sys-file-writer.c b/src/data/sys-file-writer.c index c5392666..6cbd7557 100644 --- a/src/data/sys-file-writer.c +++ b/src/data/sys-file-writer.c @@ -333,7 +333,7 @@ write_header (struct sfm_writer *w, const struct dictionary *d) } else { - static const char *month_name[12] = + static const char *const month_name[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", diff --git a/src/ui/gui/clipboard.c b/src/ui/gui/clipboard.c index 4d7ca63e..21438619 100644 --- a/src/ui/gui/clipboard.c +++ b/src/ui/gui/clipboard.c @@ -33,7 +33,7 @@ /* A casereader and dictionary holding the data currently in the clip */ static struct casereader *clip_datasheet = NULL; -struct dictionary *clip_dict = NULL; +static struct dictionary *clip_dict = NULL; diff --git a/src/ui/gui/find-dialog.c b/src/ui/gui/find-dialog.c index 432afa15..508c4ae7 100644 --- a/src/ui/gui/find-dialog.c +++ b/src/ui/gui/find-dialog.c @@ -375,7 +375,7 @@ enum iteration_type{ n_iterators }; -static struct casenum_iterator ip[n_iterators] = +static const struct casenum_iterator ip[n_iterators] = { {cp1, last, forward}, {cp1c, cm1, forward_wrap}, @@ -386,7 +386,7 @@ static struct casenum_iterator ip[n_iterators] = /* A factory returning an iterator according to the dialog box's settings */ -static struct casenum_iterator * +static const struct casenum_iterator * get_iteration_params (const struct find_dialog *fd) { gboolean wrap = gtk_toggle_button_get_active @@ -742,7 +742,7 @@ find_value (const struct find_dialog *fd, casenumber current_row, { union value *val = value_create (width); casenumber i; - struct casenum_iterator *ip = get_iteration_params (fd); + const struct casenum_iterator *ip = get_iteration_params (fd); struct comparator *cmptr = comparator_factory (var, target_string, flags); diff --git a/src/ui/gui/psppire-hbuttonbox.c b/src/ui/gui/psppire-hbuttonbox.c index ae5f3094..3332a354 100644 --- a/src/ui/gui/psppire-hbuttonbox.c +++ b/src/ui/gui/psppire-hbuttonbox.c @@ -40,7 +40,7 @@ static void gtk_hbutton_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static GtkButtonBoxStyle default_layout_style = GTK_BUTTONBOX_EDGE; +static const GtkButtonBoxStyle default_layout_style = GTK_BUTTONBOX_EDGE; GType psppire_hbutton_box_get_type (void) diff --git a/src/ui/gui/psppire-keypad.c b/src/ui/gui/psppire-keypad.c index 54e6d431..19b8cabf 100644 --- a/src/ui/gui/psppire-keypad.c +++ b/src/ui/gui/psppire-keypad.c @@ -31,7 +31,7 @@ enum { static void psppire_keypad_class_init (PsppireKeypadClass *klass); static void psppire_keypad_init (PsppireKeypad *kp); -static guint keypad_signals[n_SIGNALS] = { 0 }; +static guint keypad_signals [n_SIGNALS] = { 0 }; GType psppire_keypad_get_type (void) @@ -125,7 +125,7 @@ psppire_keypad_class_init (PsppireKeypadClass *klass) The order of these must correspond to the order of the button declarations */ -static const char *keypad_insert_text[] = { +static const char * const keypad_insert_text[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "+", "-", "*", "**", "/", "=", "<>", "<", "<=", ">", ">=", "&", "|", "~", "()", NULL diff --git a/src/ui/gui/psppire-vbuttonbox.c b/src/ui/gui/psppire-vbuttonbox.c index 7cd17573..98c2898c 100644 --- a/src/ui/gui/psppire-vbuttonbox.c +++ b/src/ui/gui/psppire-vbuttonbox.c @@ -40,7 +40,7 @@ static void gtk_vbutton_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static GtkButtonBoxStyle default_layout_style = GTK_BUTTONBOX_EDGE; +static const GtkButtonBoxStyle default_layout_style = GTK_BUTTONBOX_EDGE; GType psppire_vbutton_box_get_type (void)