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 cleanup compilation (not TRT, but the ...



details:   https://anonhg.NetBSD.org/src/rev/e3c4df410d89
branches:  trunk
changeset: 773494:e3c4df410d89
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Feb 03 21:36:40 2012 +0000

description:
cleanup compilation (not TRT, but the expedient way)

diffstat:

 external/bsd/ntp/dist/libopts/autoopts.h              |   7 +---
 external/bsd/ntp/dist/sntp/libopts/autoopts.c         |  13 ++++----
 external/bsd/ntp/dist/sntp/libopts/autoopts.h         |   4 +-
 external/bsd/ntp/dist/sntp/libopts/autoopts/options.h |   4 +-
 external/bsd/ntp/dist/sntp/libopts/compat/pathfind.c  |   4 +-
 external/bsd/ntp/dist/sntp/libopts/configfile.c       |  16 +++++-----
 external/bsd/ntp/dist/sntp/libopts/enumeration.c      |  18 ++++++------
 external/bsd/ntp/dist/sntp/libopts/file.c             |   6 ++--
 external/bsd/ntp/dist/sntp/libopts/load.c             |  16 +++++-----
 external/bsd/ntp/dist/sntp/libopts/makeshell.c        |  20 ++++++------
 external/bsd/ntp/dist/sntp/libopts/nested.c           |  18 ++++++------
 external/bsd/ntp/dist/sntp/libopts/parse-duration.c   |  10 +++---
 external/bsd/ntp/dist/sntp/libopts/putshell.c         |   4 +-
 external/bsd/ntp/dist/sntp/libopts/reset.c            |   4 +-
 external/bsd/ntp/dist/sntp/libopts/save.c             |  28 +++++++++---------
 external/bsd/ntp/dist/sntp/libopts/streqvcmp.c        |   6 ++--
 external/bsd/ntp/dist/sntp/libopts/tokenize.c         |   4 +-
 17 files changed, 90 insertions(+), 92 deletions(-)

diffs (truncated from 732 to 300 lines):

diff -r e1d063e6d201 -r e3c4df410d89 external/bsd/ntp/dist/libopts/autoopts.h
--- a/external/bsd/ntp/dist/libopts/autoopts.h  Fri Feb 03 21:35:55 2012 +0000
+++ b/external/bsd/ntp/dist/libopts/autoopts.h  Fri Feb 03 21:36:40 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoopts.h,v 1.2 2010/12/04 23:08:34 christos Exp $    */
+/*     $NetBSD: autoopts.h,v 1.3 2012/02/03 21:36:40 christos Exp $    */
 
 
 /*
@@ -215,10 +215,7 @@
 
 #define AGALOC( c, w )          ao_malloc((size_t)c)
 #define AGREALOC( p, c, w )     ao_realloc((void*)p, (size_t)c)
-#define AGFREE(_p)              do{ \
-    void *X = (void*)(intptr_t)_p; \
-    ao_free(X);\
-} while (/*CONSTCOND*/0)
+#define AGFREE(_p)              ao_free((void*)(intptr_t)(p))
 #define AGDUPSTR( p, s, w )     (p = ao_strdup(s))
 
 static void *
diff -r e1d063e6d201 -r e3c4df410d89 external/bsd/ntp/dist/sntp/libopts/autoopts.c
--- a/external/bsd/ntp/dist/sntp/libopts/autoopts.c     Fri Feb 03 21:35:55 2012 +0000
+++ b/external/bsd/ntp/dist/sntp/libopts/autoopts.c     Fri Feb 03 21:36:40 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoopts.c,v 1.1.1.2 2012/01/31 21:27:48 kardel Exp $  */
+/*     $NetBSD: autoopts.c,v 1.2 2012/02/03 21:36:40 christos Exp $    */
 
 
 /**
@@ -37,7 +37,7 @@
 #endif
 
 static char const   zNil[] = "";
-static arg_types_t  argTypes             = { NULL };
+static arg_types_t  argTypes             = { .pzStr = NULL };
 static char         zOptFmtLine[16]      = { NUL };
 static ag_bool      displayEnum          = AG_FALSE;
 static char const   pkgdatadir_default[] = PKGDATADIR;
@@ -180,7 +180,8 @@
              *  THEN we have a usage problem.
              */
             if (p->optActualIndex != pOD->optIndex) {
-                fprintf(stderr, (char*)zMultiEquiv, p->pz_Name, pOD->pz_Name,
+                fprintf(stderr, (const char*)zMultiEquiv, p->pz_Name,
+                       pOD->pz_Name,
                         (pOpts->pOptDesc + p->optActualIndex)->pz_Name);
                 return FAILURE;
             }
@@ -273,7 +274,7 @@
     int        idxLim   = pOpts->optCt;
     int        matchCt  = 0;
     int        matchIdx = 0;
-    int        nameLen;
+    size_t     nameLen;
     char       opt_name_buf[128];
 
     /*
@@ -281,7 +282,7 @@
      *  copy it off so we can NUL terminate.
      */
     if (pzEq != NULL) {
-        nameLen = (int)(pzEq - pzOptName);
+        nameLen = (size_t)(pzEq - pzOptName);
         if (nameLen >= sizeof(opt_name_buf))
             return FAILURE;
         memcpy(opt_name_buf, pzOptName, nameLen);
@@ -517,7 +518,7 @@
          *  strip off the "const" quality of the "default_opt" field.
          */
         while (*(++pz) == '-')   ;
-        def_opt = (void *)&(pOpts->specOptIdx.default_opt);
+        def_opt = (void *)(intptr_t)&(pOpts->specOptIdx.default_opt);
         def = *def_opt;
         *def_opt = NO_EQUIVALENT;
         res = longOptionFind(pOpts, pz, pOptState);
diff -r e1d063e6d201 -r e3c4df410d89 external/bsd/ntp/dist/sntp/libopts/autoopts.h
--- a/external/bsd/ntp/dist/sntp/libopts/autoopts.h     Fri Feb 03 21:35:55 2012 +0000
+++ b/external/bsd/ntp/dist/sntp/libopts/autoopts.h     Fri Feb 03 21:36:40 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoopts.h,v 1.3 2012/02/01 07:46:23 kardel Exp $      */
+/*     $NetBSD: autoopts.h,v 1.4 2012/02/03 21:36:40 christos Exp $    */
 
 
 /*
@@ -185,7 +185,7 @@
 
 #define AGALOC(c, w)          ao_malloc((size_t)c)
 #define AGREALOC(p, c, w)     ao_realloc((void*)p, (size_t)c)
-#define AGFREE(_p)            free((void *)_p)
+#define AGFREE(p)            free((void *)(intptr_t)p)
 #define AGDUPSTR(p, s, w)     (p = ao_strdup(s))
 
 static void *
diff -r e1d063e6d201 -r e3c4df410d89 external/bsd/ntp/dist/sntp/libopts/autoopts/options.h
--- a/external/bsd/ntp/dist/sntp/libopts/autoopts/options.h     Fri Feb 03 21:35:55 2012 +0000
+++ b/external/bsd/ntp/dist/sntp/libopts/autoopts/options.h     Fri Feb 03 21:36:40 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: options.h,v 1.4 2012/02/01 20:48:01 kardel Exp $       */
+/*     $NetBSD: options.h,v 1.5 2012/02/03 21:36:40 christos Exp $     */
 
 /*   -*- buffer-read-only: t -*- vi: set ro:
  *  
@@ -1022,7 +1022,7 @@
 
 extern void optionLoadOpt(tOptions*, tOptDesc*);
 
-extern ag_bool optionMakePath(char*, int, char const*, char const*);
+extern ag_bool optionMakePath(char*, size_t, char const*, char const*);
 
 extern void optionNestedVal(tOptions*, tOptDesc*);
 
diff -r e1d063e6d201 -r e3c4df410d89 external/bsd/ntp/dist/sntp/libopts/compat/pathfind.c
--- a/external/bsd/ntp/dist/sntp/libopts/compat/pathfind.c      Fri Feb 03 21:35:55 2012 +0000
+++ b/external/bsd/ntp/dist/sntp/libopts/compat/pathfind.c      Fri Feb 03 21:36:40 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pathfind.c,v 1.1.1.2 2012/01/31 21:27:55 kardel Exp $  */
+/*     $NetBSD: pathfind.c,v 1.2 2012/02/03 21:36:41 christos Exp $    */
 
 /*  -*- Mode: C -*-  */
 
@@ -311,7 +311,7 @@
                 goto copy_done;
             }
 
-            if ((pzDest - pzDir) >= AG_PATH_MAX)
+            if ((size_t)(pzDest - pzDir) >= AG_PATH_MAX)
                 break;
         } copy_done:;
 
diff -r e1d063e6d201 -r e3c4df410d89 external/bsd/ntp/dist/sntp/libopts/configfile.c
--- a/external/bsd/ntp/dist/sntp/libopts/configfile.c   Fri Feb 03 21:35:55 2012 +0000
+++ b/external/bsd/ntp/dist/sntp/libopts/configfile.c   Fri Feb 03 21:36:40 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: configfile.c,v 1.1.1.2 2012/01/31 21:27:51 kardel Exp $        */
+/*     $NetBSD: configfile.c,v 1.2 2012/02/03 21:36:40 christos Exp $  */
 
 /**
  * \file configfile.c
@@ -179,7 +179,7 @@
     else do {
         tArgList* pAL = pOptDesc->optCookie;
         int    ct   = pAL->useCt;
-        void** ppOV = (void**)(pAL->apzArgs);
+        void** ppOV = (void**)(intptr_t)(pAL->apzArgs);
 
         if (ct == 0) {
             errno = ENOENT;
@@ -256,7 +256,7 @@
     else do {
         tArgList* pAL = pOptDesc->optCookie;
         int    ct   = pAL->useCt;
-        void** ppOV = (void**)pAL->apzArgs;
+        void** ppOV = (void**)(intptr_t)pAL->apzArgs;
 
         if (ct == 0) {
             errno = ENOENT;
@@ -319,7 +319,7 @@
 
     if (pAL->useCt > 0) {
         int    ct    = pAL->useCt;
-        void** papOV = (void**)(pAL->apzArgs);
+        void** papOV = (void**)(intptr_t)(pAL->apzArgs);
 
         if (pzValName == NULL) {
             pRes = (tOptionValue*)*papOV;
@@ -380,7 +380,7 @@
     pAL = pOVList->v.nestVal;
     {
         int    ct    = pAL->useCt;
-        void** papNV = (void**)(pAL->apzArgs);
+        void** papNV = (void**)(intptr_t)(pAL->apzArgs);
 
         while (ct-- > 0) {
             tOptionValue* pNV = *(papNV++);
@@ -1099,7 +1099,7 @@
 
     {
         char const ** pp =
-            (char const **)(void *)&(pOpts->pzProgName);
+            (char const **)(intptr_t)&(pOpts->pzProgName);
         *pp = pzProgram;
     }
 
@@ -1384,12 +1384,12 @@
     if (pOpts->pzProgName == NULL) {
         char const *  pz = strrchr(pzProgram, DIRCH);
         char const ** pp =
-            (char const **)(void **)&(pOpts->pzProgName);
+            (char const **)(intptr_t)&(pOpts->pzProgName);
         if (pz == NULL)
              *pp = pzProgram;
         else *pp = pz+1;
 
-        pp  = (char const **)(void **)&(pOpts->pzProgPath);
+        pp  = (char const **)(intptr_t)&(pOpts->pzProgPath);
         *pp = pzProgram;
 
         /*
diff -r e1d063e6d201 -r e3c4df410d89 external/bsd/ntp/dist/sntp/libopts/enumeration.c
--- a/external/bsd/ntp/dist/sntp/libopts/enumeration.c  Fri Feb 03 21:35:55 2012 +0000
+++ b/external/bsd/ntp/dist/sntp/libopts/enumeration.c  Fri Feb 03 21:36:40 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: enumeration.c,v 1.1.1.2 2012/01/31 21:27:45 kardel Exp $       */
+/*     $NetBSD: enumeration.c,v 1.2 2012/02/03 21:36:40 christos Exp $ */
 
 
 /**
@@ -127,7 +127,7 @@
      *  Otherwise, columnize the output
      */
     else {
-        int   ent_no = 0;
+        size_t ent_no = 0;
         char  zFmt[16];  /* format for all-but-last entries on a line */
 
         sprintf(zFmt, "%%-%ds", (int)max_len);
@@ -178,11 +178,11 @@
      *  The result gets stashed in a char* pointer.
      */
     uintptr_t   res = name_ct;
-    size_t      len = strlen((char*)pzName);
+    size_t      len = strlen(pzName);
     uintptr_t   idx;
 
     if (IS_DEC_DIGIT_CHAR(*pzName)) {
-        char * pz = (char *)(void *)pzName;
+        char * pz = (char *)(intptr_t)pzName;
         unsigned long val = strtoul(pz, &pz, 0);
         if ((*pz == NUL) && (val < name_ct))
             return (uintptr_t)val;
@@ -195,11 +195,11 @@
      *  Multiple partial matches means we have an ambiguous match.
      */
     for (idx = 0; idx < name_ct; idx++) {
-        if (strncmp((char*)paz_names[idx], (char*)pzName, len) == 0) {
+        if (strncmp(paz_names[idx], pzName, len) == 0) {
             if (paz_names[idx][len] == NUL)
                 return idx;  /* full match */
 
-            res = (res != name_ct) ? ~0 : idx; /* save partial match */
+            res = (res != name_ct) ? (uintptr_t)~0 : idx; /* save partial match */
         }
     }
 
@@ -330,7 +330,7 @@
     /*
      *  print the name string.
      */
-    int       ix   =  0;
+    size_t    ix   =  0;
     uintptr_t bits = (uintptr_t)pOD->optCookie;
     size_t    len  = 0;
 
@@ -355,7 +355,7 @@
 
     char *    pz;
     uintptr_t bits = (uintptr_t)pOD->optCookie;
-    int       ix   = 0;
+    size_t    ix   = 0;
     size_t    len  = sizeof(none);
 
     bits &= ((uintptr_t)1 << (uintptr_t)name_ct) - (uintptr_t)1;
@@ -479,7 +479,7 @@
                 if (pz != pzArg + len) {
                     char z[ AO_NAME_SIZE ];
                     char const* p;
-                    int  shift_ct;
+                    size_t shift_ct;
 
                     if (*pz != NUL) {
                         if (len >= AO_NAME_LIMIT)
diff -r e1d063e6d201 -r e3c4df410d89 external/bsd/ntp/dist/sntp/libopts/file.c
--- a/external/bsd/ntp/dist/sntp/libopts/file.c Fri Feb 03 21:35:55 2012 +0000
+++ b/external/bsd/ntp/dist/sntp/libopts/file.c Fri Feb 03 21:36:40 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: file.c,v 1.1.1.2 2012/01/31 21:27:51 kardel Exp $      */
+/*     $NetBSD: file.c,v 1.2 2012/02/03 21:36:40 christos Exp $        */
 
 
 /**
@@ -136,7 +136,7 @@
         }
 
         if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0)
-            pOD->optCookie = (void *)pOD->optArg.argString;
+            pOD->optCookie = (void *)(intptr_t)pOD->optArg.argString;
         else
             AGDUPSTR(pOD->optCookie, pOD->optArg.argString, "file name");
 
@@ -156,7 +156,7 @@
         }
 
         if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0)
-            pOD->optCookie = (void *)pOD->optArg.argString;
+            pOD->optCookie = (void *)(intptr_t)pOD->optArg.argString;
         else
             AGDUPSTR(pOD->optCookie, pOD->optArg.argString, "file name");
 
diff -r e1d063e6d201 -r e3c4df410d89 external/bsd/ntp/dist/sntp/libopts/load.c



Home | Main Index | Thread Index | Old Index