Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/ntp/dist/sntp/libopts Replace very question poi...



details:   https://anonhg.NetBSD.org/src/rev/d0fdb5363fa8
branches:  trunk
changeset: 804086:d0fdb5363fa8
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sun Nov 23 01:47:59 2014 +0000

description:
Replace very question pointer games to override const, mark the member
writeable when inside the guts of the library.

diffstat:

 external/bsd/ntp/dist/sntp/libopts/autoopts/options.h |  10 +++++++++-
 external/bsd/ntp/dist/sntp/libopts/init.c             |  11 ++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)

diffs (60 lines):

diff -r 8932fa690e09 -r d0fdb5363fa8 external/bsd/ntp/dist/sntp/libopts/autoopts/options.h
--- a/external/bsd/ntp/dist/sntp/libopts/autoopts/options.h     Sun Nov 23 01:38:49 2014 +0000
+++ b/external/bsd/ntp/dist/sntp/libopts/autoopts/options.h     Sun Nov 23 01:47:59 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: options.h,v 1.6 2013/12/28 03:20:15 christos Exp $     */
+/*     $NetBSD: options.h,v 1.7 2014/11/23 01:47:59 joerg Exp $        */
 
 /*   -*- buffer-read-only: t -*- vi: set ro:
  *
@@ -602,9 +602,17 @@
     char *                      pzCurOpt;      ///< current option text
 
     /// Public, the full path of the program
+#if AUTOOPTS_INTERNAL
+    char const *                pzProgPath;
+#else
     char const * const          pzProgPath;
+#endif
     /// Public, the name of the executable, without any path
+#if AUTOOPTS_INTERNAL
+    char const *                pzProgName;
+#else
     char const * const          pzProgName;
+#endif
     /// Public, the upper-cased, shell variable syntax-ed program name
     char const * const          pzPROGNAME;
     /// the name of the "rc file" (configuration file)
diff -r 8932fa690e09 -r d0fdb5363fa8 external/bsd/ntp/dist/sntp/libopts/init.c
--- a/external/bsd/ntp/dist/sntp/libopts/init.c Sun Nov 23 01:38:49 2014 +0000
+++ b/external/bsd/ntp/dist/sntp/libopts/init.c Sun Nov 23 01:47:59 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.2 2013/12/28 03:20:15 christos Exp $        */
+/*     $NetBSD: init.c,v 1.3 2014/11/23 01:47:59 joerg Exp $   */
 
 /**
  * \file initialize.c
@@ -103,20 +103,17 @@
      */
     if (opts->pzProgName == NULL) {
         char const *  pz = strrchr(pname, DIRCH);
-        char const ** pp =
-            (char const **)(void **)(intptr_t)&(opts->pzProgName);
 
         if (pz != NULL)
-            *pp = pz+1;
+            opts->pzProgName = pz+1;
         else
-            *pp = pname;
+            opts->pzProgName = pname;
 
         pz = pathfind(getenv("PATH"), (char *)(intptr_t)pname, "rx");
         if (pz != NULL)
             pname = (void *)(intptr_t)pz;
 
-        pp  = (char const **)(void **)(intptr_t)&(opts->pzProgPath);
-        *pp = pname;
+        opts->pzProgPath = pname;
 
         /*
          *  when comparing long names, these are equivalent



Home | Main Index | Thread Index | Old Index