]> Savannah Git Hosting - gnulib.git/commitdiff
readutmp: fix idx_t FIXME in API
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 3 Aug 2023 22:53:30 +0000 (15:53 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 4 Aug 2023 01:20:50 +0000 (18:20 -0700)
* lib/readutmp.c (read_utmp): 2nd arg is now idx_t *, not
size_t *.
* lib/readutmp.h: Include idx.h, for idx_t.
* modules/readutmp (Depends-on): Add idx.

ChangeLog
NEWS
lib/readutmp.c
lib/readutmp.h
modules/readutmp

index 56b27d129fc720f808b277a74e2d894d04aa762d..a87e6537b1bee60d3346a5cf0316d458b60d5c36 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2023-08-03  Paul Eggert  <eggert@cs.ucla.edu>
 
+       readutmp: fix idx_t FIXME in API
+       * lib/readutmp.c (read_utmp): 2nd arg is now idx_t *, not
+       size_t *.
+       * lib/readutmp.h: Include idx.h, for idx_t.
+       * modules/readutmp (Depends-on): Add idx.
+
        readutmp: go back to simple ‘free’
        Omit the new free_utmp function.  Instead, allocate storage
        in one block, so that using code can still just call ‘free’.
diff --git a/NEWS b/NEWS
index 24139d4660b3ba73439cecc21c9a15e5777335a0..f1c9b72aa97b05333456aa0be34054b6dd4e62e0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -74,8 +74,9 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
-2023-08-01  readutmp        Some STRUCT_UTMP members can be char *,
-                            rather than fixed-length char arrays.
+2023-08-02  readutmp        Some STRUCT_UTMP members can be char *,
+2023-08-01                  rather than fixed-length char arrays.
+                            read_utmp's 2nd arg is now idx_t * not size_t *.
                             Link additionally with $(READUTMP_LIB).
 
 2023-07-10  dfa             The signature of the function
index 508978ba79166d59dae8589b098de10bc9ae3c0e..66314ec1db92945bedaa97b1c54589ec13c50116 100644 (file)
@@ -299,7 +299,7 @@ add_utmp (struct utmp_alloc a, int options,
 }
 
 int
-read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf,
+read_utmp (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
            int options)
 {
   /* Fill entries, simulating what a utmp file would contain.  */
@@ -508,7 +508,7 @@ copy_utmp_entry (STRUCT_UTMP *dst, STRUCT_UTMP *src)
 }
 
 int
-read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf,
+read_utmp (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
            int options)
 {
   idx_t n_read = 0;
@@ -544,7 +544,7 @@ read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf,
 # else
 
 int
-read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf,
+read_utmp (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
            int options)
 {
   idx_t n_read = 0;
@@ -586,7 +586,7 @@ read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf,
 #else /* dummy fallback */
 
 int
-read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf,
+read_utmp (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
            int options)
 {
   errno = ENOSYS;
index 956a8cafd925253fe0da766ef767ed818a2e388f..4897b102d2a706d804a043b629d6c51c781591e5 100644 (file)
@@ -27,6 +27,8 @@
 #  error "Please include config.h first."
 # endif
 
+# include "idx.h"
+
 # include <stdlib.h>
 # include <sys/types.h>
 
@@ -385,8 +387,7 @@ char *extract_trimmed_name (const STRUCT_UTMP *ut)
    process-IDs do not currently exist.
    If OPTIONS & READ_UTMP_USER_PROCESS is nonzero, omit entries which
    do not correspond to a user process.  */
-/* FIXME: This header should use idx_t, not size_t.  */
-int read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf,
+int read_utmp (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
                int options);
 
 #endif /* __READUTMP_H__ */
index 484edd18428ffbd032dd134f3cf6d6a57056eec5..534ce4fa19367578bbcd01032a34cfafbedec93f 100644 (file)
@@ -9,6 +9,7 @@ m4/systemd.m4
 
 Depends-on:
 extensions
+idx
 xalloc
 stdbool
 stdint