Module Name:    src
Committed By:   riastradh
Date:           Tue Aug  8 10:34:08 UTC 2023

Modified Files:
        src/include: cdbw.h
        src/lib/libc/cdb: cdbw.3 cdbw.c

Log Message:
cdbw(3): Make cdbw_output descr parameter type less confusing.

This is a string of _up to_ 16 bytes, used with strncpy(..., 16).
Specifying `const char descr[16]', while formally equivalent to
`const char *descr' in standard C, now provokes the ire of gcc when
the caller does not provide a buffer of at least 16 bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/include/cdbw.h
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/cdb/cdbw.3 src/lib/libc/cdb/cdbw.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/include/cdbw.h
diff -u src/include/cdbw.h:1.2 src/include/cdbw.h:1.3
--- src/include/cdbw.h:1.2	Sun Jun  3 21:21:45 2012
+++ src/include/cdbw.h	Tue Aug  8 10:34:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdbw.h,v 1.2 2012/06/03 21:21:45 joerg Exp $	*/
+/*	$NetBSD: cdbw.h,v 1.3 2023/08/08 10:34:08 riastradh Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -50,7 +50,7 @@ int		 cdbw_put_data(struct cdbw *, const
 int		 cdbw_put_key(struct cdbw *, const void *, size_t,
     uint32_t);
 uint32_t	 cdbw_stable_seeder(void);
-int		 cdbw_output(struct cdbw *, int, const char[16],
+int		 cdbw_output(struct cdbw *, int, const char *,
     uint32_t (*)(void));
 void		 cdbw_close(struct cdbw *);
 

Index: src/lib/libc/cdb/cdbw.3
diff -u src/lib/libc/cdb/cdbw.3:1.8 src/lib/libc/cdb/cdbw.3:1.9
--- src/lib/libc/cdb/cdbw.3:1.8	Thu Feb  6 15:50:40 2014
+++ src/lib/libc/cdb/cdbw.3	Tue Aug  8 10:34:08 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: cdbw.3,v 1.8 2014/02/06 15:50:40 rmind Exp $
+.\"	$NetBSD: cdbw.3,v 1.9 2023/08/08 10:34:08 riastradh Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -74,7 +74,7 @@
 .Fo cdbw_output
 .Fa "struct cdbw *cdbw"
 .Fa "int output"
-.Fa "const char descr[16]"
+.Fa "const char *descr"
 .Fa "uint32_t (*seedgen)(void)"
 .Fc
 .Ft void
@@ -113,7 +113,8 @@ computes the database file and writes it
 The function returns an error if the file cannot be written correctly.
 The
 .Fa descr
-parameter provides a human readable description of the database content.
+parameter, a string of up to 16 bytes, provides a human readable
+description of the database content.
 The
 .Fa seedgen
 parameter can be used to override the default PRNG.
Index: src/lib/libc/cdb/cdbw.c
diff -u src/lib/libc/cdb/cdbw.c:1.8 src/lib/libc/cdb/cdbw.c:1.9
--- src/lib/libc/cdb/cdbw.c:1.8	Tue Apr 19 20:32:14 2022
+++ src/lib/libc/cdb/cdbw.c	Tue Aug  8 10:34:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdbw.c,v 1.8 2022/04/19 20:32:14 rillig Exp $	*/
+/*	$NetBSD: cdbw.c,v 1.9 2023/08/08 10:34:08 riastradh Exp $	*/
 /*-
  * Copyright (c) 2009, 2010, 2015 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: cdbw.c,v 1.8 2022/04/19 20:32:14 rillig Exp $");
+__RCSID("$NetBSD: cdbw.c,v 1.9 2023/08/08 10:34:08 riastradh Exp $");
 
 #include "namespace.h"
 
@@ -602,7 +602,7 @@ print_hash(struct cdbw *cdbw, struct sta
 }
 
 int
-cdbw_output(struct cdbw *cdbw, int fd, const char descr[16],
+cdbw_output(struct cdbw *cdbw, int fd, const char *descr,
     uint32_t (*seedgen)(void))
 {
 	struct state state;

Reply via email to