diff mbox series

[1/3] libio: make _IO_least_marker static

Message ID 20241108171450.411932-2-siddhesh@sourceware.org
State New
Headers show
Series Guarantee first pushback in ungetc and ungetwc | expand

Commit Message

Siddhesh Poyarekar Nov. 8, 2024, 5:14 p.m. UTC
Trivial cleanup to limit _IO_least_marker so that it's clear that it is
unused outside of genops.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
---
 libio/genops.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Florian Weimer Nov. 28, 2024, 12:50 p.m. UTC | #1
* Siddhesh Poyarekar:

> Trivial cleanup to limit _IO_least_marker so that it's clear that it is
> unused outside of genops.
>
> Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
> ---
>  libio/genops.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/libio/genops.c b/libio/genops.c
> index 6f20d49669..6545a78ad5 100644
> --- a/libio/genops.c
> +++ b/libio/genops.c
> @@ -135,10 +135,8 @@ libc_hidden_def (_IO_link_in)
>  
>  /* Return minimum _pos markers
>     Assumes the current get area is the main get area. */
> -ssize_t _IO_least_marker (FILE *fp, char *end_p);
> -
> -ssize_t
> -_IO_least_marker (FILE *fp, char *end_p)
> +static ssize_t
> +least_marker (FILE *fp, char *end_p)
>  {
>    ssize_t least_so_far = end_p - fp->_IO_read_base;
>    struct _IO_marker *mark;
> @@ -235,7 +233,7 @@ static int
>  save_for_backup (FILE *fp, char *end_p)
>  {
>    /* Append [_IO_read_base..end_p] to backup area. */
> -  ssize_t least_mark = _IO_least_marker (fp, end_p);
> +  ssize_t least_mark = least_marker (fp, end_p);
>    /* needed_size is how much space we need in the backup area. */
>    size_t needed_size = (end_p - fp->_IO_read_base) - least_mark;
>    /* FIXME: Dubious arithmetic if pointers are NULL */

It's sometimes helpful to have namespaced static functions, so I would
just delete the prototype and add the static keyword.

Thanks,
Florian
diff mbox series

Patch

diff --git a/libio/genops.c b/libio/genops.c
index 6f20d49669..6545a78ad5 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -135,10 +135,8 @@  libc_hidden_def (_IO_link_in)
 
 /* Return minimum _pos markers
    Assumes the current get area is the main get area. */
-ssize_t _IO_least_marker (FILE *fp, char *end_p);
-
-ssize_t
-_IO_least_marker (FILE *fp, char *end_p)
+static ssize_t
+least_marker (FILE *fp, char *end_p)
 {
   ssize_t least_so_far = end_p - fp->_IO_read_base;
   struct _IO_marker *mark;
@@ -235,7 +233,7 @@  static int
 save_for_backup (FILE *fp, char *end_p)
 {
   /* Append [_IO_read_base..end_p] to backup area. */
-  ssize_t least_mark = _IO_least_marker (fp, end_p);
+  ssize_t least_mark = least_marker (fp, end_p);
   /* needed_size is how much space we need in the backup area. */
   size_t needed_size = (end_p - fp->_IO_read_base) - least_mark;
   /* FIXME: Dubious arithmetic if pointers are NULL */