Source-Changes-HG archive

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

[src/trunk]: src/crypto/dist/ipsec-tools/src/racoon make debugrm compile again.



details:   https://anonhg.NetBSD.org/src/rev/9f6ae8adf062
branches:  trunk
changeset: 321711:9f6ae8adf062
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Apr 01 22:35:22 2018 +0000

description:
make debugrm compile again.

diffstat:

 crypto/dist/ipsec-tools/src/racoon/debugrm.c |  98 +++++++++------------------
 crypto/dist/ipsec-tools/src/racoon/debugrm.h |  24 +++---
 2 files changed, 46 insertions(+), 76 deletions(-)

diffs (275 lines):

diff -r 40f8528c60e8 -r 9f6ae8adf062 crypto/dist/ipsec-tools/src/racoon/debugrm.c
--- a/crypto/dist/ipsec-tools/src/racoon/debugrm.c      Sun Apr 01 21:19:17 2018 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/debugrm.c      Sun Apr 01 22:35:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: debugrm.c,v 1.3 2006/09/09 16:22:09 manu Exp $ */
+/*     $NetBSD: debugrm.c,v 1.4 2018/04/01 22:35:22 christos Exp $     */
 
 /*     $KAME: debugrm.c,v 1.6 2001/12/13 16:07:46 sakane Exp $ */
 
@@ -51,37 +51,38 @@
 #define DRMLISTSIZE 1024
 
 struct drm_list_t {
-       void *ptr;
+       const void *ptr;
        char msg[100];
 };
 static struct drm_list_t drmlist[DRMLISTSIZE];
 
 static int drm_unknown;
 
-static void DRM_add __P((void *, char *));
-static void DRM_del __P((void *));
-static void DRM_setmsg __P((char *, int, void *, int, char *, int, char *));
+static void DRM_add(const void *, const char *);
+static void DRM_del(const void *);
+static void DRM_setmsg(char *, size_t, const void *, size_t, const char *,
+    size_t, const char *);
 
 void 
-DRM_init()
+DRM_init(void)
 {
-       int i;
+       size_t i;
        drm_unknown = 0;
-       for (i = 0; i < sizeof(drmlist)/sizeof(drmlist[0]); i++)
+       for (i = 0; i < __arraycount(drmlist); i++)
                drmlist[i].ptr = 0;
 }
 
 void
-DRM_dump()
+DRM_dump(void)
 {
        FILE *fp;
-       int i;
+       size_t i;
 
        fp = fopen(DRMDUMPFILE, "w");
        if (fp == NULL)
                err(1, "fopen");        /*XXX*/
        fprintf(fp, "drm_unknown=%d\n", drm_unknown);
-       for (i = 0; i < sizeof(drmlist)/sizeof(drmlist[0]); i++) {
+       for (i = 0; i < __arraycount(drmlist); i++) {
                if (drmlist[i].ptr)
                        fprintf(fp, "%s\n", drmlist[i].msg);
        }
@@ -89,12 +90,10 @@
 }
 
 static void 
-DRM_add(p, msg)
-       void *p;
-       char *msg;
+DRM_add(const void *p, const char *msg)
 {
-       int i;
-       for (i = 0; i < sizeof(drmlist)/sizeof(drmlist[0]); i++) {
+       size_t i;
+       for (i = 0; i < __arraycount(drmlist); i++) {
                if (!drmlist[i].ptr) {
                        drmlist[i].ptr = p;
                        strlcpy(drmlist[i].msg, msg, sizeof(drmlist[i].msg));
@@ -104,15 +103,14 @@
 }
 
 static void
-DRM_del(p)
-       void *p;
+DRM_del(const void *p)
 {
-       int i;
+       size_t i;
 
        if (!p)
                return;
 
-       for (i = 0; i < sizeof(drmlist)/sizeof(drmlist[0]); i++) {
+       for (i = 0; i < __arraycount(drmlist); i++) {
                if (drmlist[i].ptr == p) {
                        drmlist[i].ptr = 0;
                        return;
@@ -122,10 +120,8 @@
 }
 
 static void
-DRM_setmsg(buf, buflen, ptr, size, file, line, func)
-       char *buf, *file, *func;
-       int buflen, size, line;
-       void *ptr;
+DRM_setmsg(char *buf, size_t buflen, const void *ptr, size_t size,
+    const char *file, size_t line, const char *func)
 {
        time_t t;
        struct tm *tm;
@@ -136,14 +132,11 @@
        len = strftime(buf, buflen, "%Y/%m/%d:%T ", tm);
 
        snprintf(buf + len, buflen - len, "%p %6d %s:%d:%s",
-               ptr, size, file , line, func);
+               ptr, size, file, line, func);
 }
 
 void *
-DRM_malloc(file, line, func, size)
-       char *file, *func;
-       int line;
-       size_t size;
+DRM_malloc(const char *file, size_t line, const char *func, size_t size)
 {
        void *p;
 
@@ -158,10 +151,8 @@
 }
 
 void *
-DRM_calloc(file, line, func, number, size)
-       char *file, *func;
-       int line;
-       size_t number, size;
+DRM_calloc(const char *file, size_t line, const char *func, size_t number,
+    size_t size)
 {
        void *p;
 
@@ -175,11 +166,8 @@
 }
 
 void *
-DRM_realloc(file, line, func, ptr, size)
-       char *file, *func;
-       int line;
-       void *ptr;
-       size_t size;
+DRM_realloc(const char *file, size_t line, const char *func, void *ptr,
+    size_t size)
 {
        void *p;
 
@@ -197,20 +185,14 @@
 }
 
 void
-DRM_free(file, line, func, ptr)
-       char *file, *func;
-       int line;
-       void *ptr;
+DRM_free(const char *file, size_t line, const char *func, void *ptr)
 {
        DRM_del(ptr);
        free(ptr);
 }
 
 char *
-DRM_strdup(file, line, func, str)
-       char *file, *func;
-       int line;
-       const char *str;
+DRM_strdup(const char *file, size_t line, const char *func, const char *str)
 {
        char *p;
 
@@ -218,7 +200,7 @@
 
        if (p) {
                char buf[1024];
-               DRM_setmsg(buf, sizeof(buf), p, size, file, line, func);
+               DRM_setmsg(buf, sizeof(buf), p, strlen(p), file, line, func);
                DRM_add(p, buf);
        }
 
@@ -229,10 +211,7 @@
  * mask vmbuf.c functions.
  */
 void *
-DRM_vmalloc(file, line, func, size)
-       char *file, *func;
-       int line;
-       size_t size;
+DRM_vmalloc(const char *file, size_t line, const char *func, size_t size)
 {
        void *p;
 
@@ -247,11 +226,8 @@
 }
 
 void *
-DRM_vrealloc(file, line, func, ptr, size)
-       char *file, *func;
-       int line;
-       void *ptr;
-       size_t size;
+DRM_vrealloc(const char *file, size_t line, const char *func, void *ptr,
+    size_t size)
 {
        void *p;
 
@@ -269,20 +245,14 @@
 }
 
 void
-DRM_vfree(file, line, func, ptr)
-       char *file, *func;
-       int line;
-       void *ptr;
+DRM_vfree(const char *file, size_t line, const char *func, void *ptr)
 {
        DRM_del(ptr);
        vfree(ptr);
 }
 
 void *
-DRM_vdup(file, line, func, ptr)
-       char *file, *func;
-       int line;
-       void *ptr;
+DRM_vdup(const char *file, size_t line, const char *func, void *ptr)
 {
        void *p;
 
diff -r 40f8528c60e8 -r 9f6ae8adf062 crypto/dist/ipsec-tools/src/racoon/debugrm.h
--- a/crypto/dist/ipsec-tools/src/racoon/debugrm.h      Sun Apr 01 21:19:17 2018 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/debugrm.h      Sun Apr 01 22:35:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: debugrm.h,v 1.4 2006/09/09 16:22:09 manu Exp $ */
+/*     $NetBSD: debugrm.h,v 1.5 2018/04/01 22:35:22 christos Exp $     */
 
 /* Id: debugrm.h,v 1.4 2006/04/06 14:00:06 manubsd Exp */
 
@@ -75,13 +75,13 @@
 #endif
 #endif /*NONEED_DRM*/
 
-extern void DRM_init __P((void));
-extern void DRM_dump __P((void));
-extern void *DRM_malloc __P((char *, int, char *, size_t));
-extern void *DRM_calloc __P((char *, int, char *, size_t, size_t));
-extern void *DRM_realloc __P((char *, int, char *, void *, size_t));
-extern void DRM_free __P((char *, int, char *, void *));
-extern char *DRM_strdup __P((char *, int, char *, const char *));
+extern void DRM_init(void);
+extern void DRM_dump(void);
+extern void *DRM_malloc(const char *, size_t, const char *, size_t);
+extern void *DRM_calloc(const char *, size_t, const char *, size_t, size_t);
+extern void *DRM_realloc(const char *, size_t, const char *, void *, size_t);
+extern void DRM_free(const char *, size_t, const char *, void *);
+extern char *DRM_strdup(const char *, size_t, const char *, const char *);
 
 #ifndef NONEED_DRM
 #define        vmalloc(sz)     \
@@ -94,9 +94,9 @@
        DRM_vfree(__FILE__, __LINE__, __func__, (p))
 #endif
 
-extern void *DRM_vmalloc __P((char *, int, char *, size_t));
-extern void *DRM_vrealloc __P((char *, int, char *, void *, size_t));
-extern void DRM_vfree __P((char *, int, char *, void *));
-extern void *DRM_vdup __P((char *, int, char *, void *));
+extern void *DRM_vmalloc(const char *, size_t, const char *, size_t);
+extern void *DRM_vrealloc(const char *, size_t, const char *, void *, size_t);
+extern void DRM_vfree(const char *, size_t, const char *, void *);
+extern void *DRM_vdup(const char *, size_t, const char *, void *);
 
 #endif /* _DEBUGRM_H */



Home | Main Index | Thread Index | Old Index