diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2016-11-26 22:05:42 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2016-11-26 22:05:42 -0500 |
commit | d2c0eef48a1bb331ca08f8f26ff82c5d4086ba0c (patch) | |
tree | 76dc8a66856e9223a9b77bb9a9c55ed49331def8 /gdb | |
parent | 82bbe65a43015a753bec8c64869679a699331a5b (diff) | |
download | gdb-d2c0eef48a1bb331ca08f8f26ff82c5d4086ba0c.zip gdb-d2c0eef48a1bb331ca08f8f26ff82c5d4086ba0c.tar.gz gdb-d2c0eef48a1bb331ca08f8f26ff82c5d4086ba0c.tar.bz2 |
Constify wrap_here/wrap_hint code path
Constify the data path between ui_out_wrap_hint and the wrap_indent
global, because we can. It's clearer that the argument passed to
wrap_hint is not intended to be modified by the ui_out implementation.
gdb/ChangeLog:
* mi/mi-out.c (mi_wrap_hint): Constify argument.
* cli-out.c (cli_wrap_hint): Likewise.
* ui-out.c (ui_out_wrap_hint, uo_wrap_hint): Likewise.
* ui-out.h (ui_out_wrap_hint, wrap_hint_ftype): Likewise.
* utils.c (wrap_here): Likewise.
(wrap_indent): Constify.
* utils.h (wrap_here): Constify argument.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/cli-out.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-out.c | 4 | ||||
-rw-r--r-- | gdb/ui-out.c | 6 | ||||
-rw-r--r-- | gdb/ui-out.h | 4 | ||||
-rw-r--r-- | gdb/utils.c | 4 | ||||
-rw-r--r-- | gdb/utils.h | 2 |
7 files changed, 21 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d6d5dc6..25f4033 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2016-11-26 Simon Marchi <simon.marchi@polymtl.ca> + * mi/mi-out.c (mi_wrap_hint): Constify argument. + * cli-out.c (cli_wrap_hint): Likewise. + * ui-out.c (ui_out_wrap_hint, uo_wrap_hint): Likewise. + * ui-out.h (ui_out_wrap_hint, wrap_hint_ftype): Likewise. + * utils.c (wrap_here): Likewise. + (wrap_indent): Constify. + * utils.h (wrap_here): Constify argument. + +2016-11-26 Simon Marchi <simon.marchi@polymtl.ca> + * ui-out.c (uo_redirect): Return the return value from the implementation function. diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 0c982cb..d208207 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -290,7 +290,7 @@ cli_message (struct ui_out *uiout, int verbosity, } static void -cli_wrap_hint (struct ui_out *uiout, char *identstring) +cli_wrap_hint (struct ui_out *uiout, const char *identstring) { cli_out_data *data = (cli_out_data *) ui_out_data (uiout); diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index 0f48426..960529c 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -65,7 +65,7 @@ static void mi_text (struct ui_out *uiout, const char *string); static void mi_message (struct ui_out *uiout, int verbosity, const char *format, va_list args) ATTRIBUTE_PRINTF (3, 0); -static void mi_wrap_hint (struct ui_out *uiout, char *identstring); +static void mi_wrap_hint (struct ui_out *uiout, const char *identstring); static void mi_flush (struct ui_out *uiout); static int mi_redirect (struct ui_out *uiout, struct ui_file *outstream); @@ -273,7 +273,7 @@ mi_message (struct ui_out *uiout, int verbosity, } void -mi_wrap_hint (struct ui_out *uiout, char *identstring) +mi_wrap_hint (struct ui_out *uiout, const char *identstring) { wrap_here (identstring); } diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 7f36545..64d0443 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -172,7 +172,7 @@ static void uo_text (struct ui_out *uiout, const char *string); static void uo_message (struct ui_out *uiout, int verbosity, const char *format, va_list args) ATTRIBUTE_PRINTF (3, 0); -static void uo_wrap_hint (struct ui_out *uiout, char *identstring); +static void uo_wrap_hint (struct ui_out *uiout, const char *identstring); static void uo_flush (struct ui_out *uiout); static int uo_redirect (struct ui_out *uiout, struct ui_file *outstream); @@ -505,7 +505,7 @@ ui_out_message (struct ui_out *uiout, int verbosity, } void -ui_out_wrap_hint (struct ui_out *uiout, char *identstring) +ui_out_wrap_hint (struct ui_out *uiout, const char *identstring) { uo_wrap_hint (uiout, identstring); } @@ -683,7 +683,7 @@ uo_message (struct ui_out *uiout, int verbosity, } void -uo_wrap_hint (struct ui_out *uiout, char *identstring) +uo_wrap_hint (struct ui_out *uiout, const char *identstring) { if (!uiout->impl->wrap_hint) return; diff --git a/gdb/ui-out.h b/gdb/ui-out.h index 864048c..569f762 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -123,7 +123,7 @@ extern void ui_out_message (struct ui_out *uiout, int verbosity, const char *format, ...) ATTRIBUTE_PRINTF (3, 4); -extern void ui_out_wrap_hint (struct ui_out *uiout, char *identstring); +extern void ui_out_wrap_hint (struct ui_out *uiout, const char *identstring); extern void ui_out_flush (struct ui_out *uiout); @@ -186,7 +186,7 @@ typedef void (text_ftype) (struct ui_out * uiout, typedef void (message_ftype) (struct ui_out * uiout, int verbosity, const char *format, va_list args) ATTRIBUTE_FPTR_PRINTF(3,0); -typedef void (wrap_hint_ftype) (struct ui_out * uiout, char *identstring); +typedef void (wrap_hint_ftype) (struct ui_out * uiout, const char *identstring); typedef void (flush_ftype) (struct ui_out * uiout); typedef int (redirect_ftype) (struct ui_out * uiout, struct ui_file * outstream); diff --git a/gdb/utils.c b/gdb/utils.c index 8ca0a2e..3a88e2a 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1628,7 +1628,7 @@ static char *wrap_pointer; /* String to indent by if the wrap occurs. Must not be NULL if wrap_column is non-zero. */ -static char *wrap_indent; +static const char *wrap_indent; /* Column number on the screen where wrap_buffer begins, or 0 if wrapping is not in effect. */ @@ -1911,7 +1911,7 @@ reinitialize_more_filter (void) used to force out output from the wrap_buffer. */ void -wrap_here (char *indent) +wrap_here (const char *indent) { /* This should have been allocated, but be paranoid anyway. */ if (!wrap_buffer) diff --git a/gdb/utils.h b/gdb/utils.h index 62091f0..f2fb54d 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -146,7 +146,7 @@ extern int yquery (const char *, ...) ATTRIBUTE_PRINTF (1, 2); extern void begin_line (void); -extern void wrap_here (char *); +extern void wrap_here (const char *); extern void reinitialize_more_filter (void); |