]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
bsearch.3: EXAMPLES: Separate struct and variable definitions
authorAlex Colomar <alx.manpages@gmail.com>
Sat, 10 Sep 2022 21:42:09 +0000 (23:42 +0200)
committerAlex Colomar <alx.manpages@gmail.com>
Mon, 12 Sep 2022 14:40:00 +0000 (16:40 +0200)
Separate struct definition from variable definition.
Also use 'static' and 'const' when possible.

Signed-off-by: Alex Colomar <alx.manpages@gmail.com>
man3/bsearch.3

index ede91e3790afb5a0bc1aa3c5fc8ccc565f8d0994..cf5fa7a0abb7ca284a1ce944b355fe6d9bd2138d 100644 (file)
@@ -89,9 +89,11 @@ then retrieves desired elements using
 #include <string.h>
 
 struct mi {
-    int nr;
-    char *name;
-} months[] = {
+    int         nr;
+    const char  *name;
+};
+
+static struct mi  months[] = {
     { 1, "jan" }, { 2, "feb" }, { 3, "mar" }, { 4, "apr" },
     { 5, "may" }, { 6, "jun" }, { 7, "jul" }, { 8, "aug" },
     { 9, "sep" }, {10, "oct" }, {11, "nov" }, {12, "dec" }