source.c: Use fgetc instead of getc.

On AIX, getc is a macro which triggers an -Wunused-value warning.

gdb/ChangeLog:

        * source.c (forward_search_command): Replace call to getc
        by call to fgetc.
        (reverse_search_command): Likewise.
This commit is contained in:
Joel Brobecker 2013-05-09 06:52:21 +00:00
parent 9f0682fe89
commit 40aea47721
2 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2013-05-09 Joel Brobecker <brobecker@adacore.com>
* source.c (forward_search_command): Replace call to getc
by call to fgetc.
(reverse_search_command): Likewise.
2013-05-08 Doug Evans <dje@google.com> 2013-05-08 Doug Evans <dje@google.com>
* psymtab.c (expand_symtabs_matching_via_partial): Fix file name * psymtab.c (expand_symtabs_matching_via_partial): Fix file name

View file

@ -1613,7 +1613,7 @@ forward_search_command (char *regex, int from_tty)
buf = xmalloc (cursize); buf = xmalloc (cursize);
p = buf; p = buf;
c = getc (stream); c = fgetc (stream);
if (c == EOF) if (c == EOF)
break; break;
do do
@ -1627,7 +1627,7 @@ forward_search_command (char *regex, int from_tty)
cursize = newsize; cursize = newsize;
} }
} }
while (c != '\n' && (c = getc (stream)) >= 0); while (c != '\n' && (c = fgetc (stream)) >= 0);
/* Remove the \r, if any, at the end of the line, otherwise /* Remove the \r, if any, at the end of the line, otherwise
regular expressions that end with $ or \n won't work. */ regular expressions that end with $ or \n won't work. */
@ -1698,14 +1698,14 @@ reverse_search_command (char *regex, int from_tty)
char buf[4096]; /* Should be reasonable??? */ char buf[4096]; /* Should be reasonable??? */
char *p = buf; char *p = buf;
c = getc (stream); c = fgetc (stream);
if (c == EOF) if (c == EOF)
break; break;
do do
{ {
*p++ = c; *p++ = c;
} }
while (c != '\n' && (c = getc (stream)) >= 0); while (c != '\n' && (c = fgetc (stream)) >= 0);
/* Remove the \r, if any, at the end of the line, otherwise /* Remove the \r, if any, at the end of the line, otherwise
regular expressions that end with $ or \n won't work. */ regular expressions that end with $ or \n won't work. */