Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make Add typedefs for DuplicateProc and FreeProc fro...



details:   https://anonhg.NetBSD.org/src/rev/95de9207c0fb
branches:  trunk
changeset: 583500:95de9207c0fb
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Aug 09 21:36:42 2005 +0000

description:
Add typedefs for DuplicateProc and FreeProc from Max Okumoto.

diffstat:

 usr.bin/make/for.c                |   8 ++++----
 usr.bin/make/lst.h                |  17 ++++++++++-------
 usr.bin/make/lst.lib/lstDestroy.c |  10 +++++-----
 usr.bin/make/lst.lib/lstDupl.c    |  10 +++++-----
 usr.bin/make/main.c               |   8 ++++----
 usr.bin/make/parse.c              |   8 ++++----
 6 files changed, 32 insertions(+), 29 deletions(-)

diffs (238 lines):

diff -r 759371dd4b5d -r 95de9207c0fb usr.bin/make/for.c
--- a/usr.bin/make/for.c        Tue Aug 09 21:25:42 2005 +0000
+++ b/usr.bin/make/for.c        Tue Aug 09 21:36:42 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: for.c,v 1.21 2005/08/08 16:42:54 christos Exp $        */
+/*     $NetBSD: for.c,v 1.22 2005/08/09 21:36:42 christos Exp $        */
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -30,14 +30,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: for.c,v 1.21 2005/08/08 16:42:54 christos Exp $";
+static char rcsid[] = "$NetBSD: for.c,v 1.22 2005/08/09 21:36:42 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)for.c      8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: for.c,v 1.21 2005/08/08 16:42:54 christos Exp $");
+__RCSID("$NetBSD: for.c,v 1.22 2005/08/09 21:36:42 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -387,6 +387,6 @@
     }
     free(arg.vars);
 
-    Lst_Destroy(arg.lst, (void (*)(ClientData)) free);
+    Lst_Destroy(arg.lst, (FreeProc *)free);
     Buf_Destroy(arg.buf, TRUE);
 }
diff -r 759371dd4b5d -r 95de9207c0fb usr.bin/make/lst.h
--- a/usr.bin/make/lst.h        Tue Aug 09 21:25:42 2005 +0000
+++ b/usr.bin/make/lst.h        Tue Aug 09 21:36:42 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lst.h,v 1.10 2003/08/07 11:14:53 agc Exp $     */
+/*     $NetBSD: lst.h,v 1.11 2005/08/09 21:36:42 christos Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -92,16 +92,19 @@
 typedef        struct  Lst     *Lst;
 typedef        struct  LstNode *LstNode;
 
-#define        NILLST          ((Lst) NIL)
-#define        NILLNODE        ((LstNode) NIL)
+typedef ClientData     DuplicateProc(ClientData);
+typedef void           FreeProc(ClientData);
+
+#define        NILLST          ((Lst)NIL)
+#define        NILLNODE        ((LstNode)NIL)
 
 /*
  * NOFREE can be used as the freeProc to Lst_Destroy when the elements are
  *     not to be freed.
  * NOCOPY performs similarly when given as the copyProc to Lst_Duplicate.
  */
-#define NOFREE         ((void (*)(ClientData)) 0)
-#define NOCOPY         ((ClientData (*)(ClientData)) 0)
+#define NOFREE         ((FreeProc *)NULL)
+#define NOCOPY         ((DuplicateProc *)NULL)
 
 #define LST_CONCNEW    0   /* create new LstNode's when using Lst_Concat */
 #define LST_CONCLINK   1   /* relink LstNode's when using Lst_Concat */
@@ -112,9 +115,9 @@
 /* Create a new list */
 Lst            Lst_Init(Boolean);
 /* Duplicate an existing list */
-Lst            Lst_Duplicate(Lst, ClientData (*)(ClientData));
+Lst            Lst_Duplicate(Lst, DuplicateProc *);
 /* Destroy an old one */
-void           Lst_Destroy(Lst, void (*)(ClientData));
+void           Lst_Destroy(Lst, FreeProc *);
 /* True if list is empty */
 Boolean                Lst_IsEmpty(Lst);
 
diff -r 759371dd4b5d -r 95de9207c0fb usr.bin/make/lst.lib/lstDestroy.c
--- a/usr.bin/make/lst.lib/lstDestroy.c Tue Aug 09 21:25:42 2005 +0000
+++ b/usr.bin/make/lst.lib/lstDestroy.c Tue Aug 09 21:36:42 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lstDestroy.c,v 1.13 2005/08/08 16:42:54 christos Exp $ */
+/*     $NetBSD: lstDestroy.c,v 1.14 2005/08/09 21:36:42 christos Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -33,14 +33,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lstDestroy.c,v 1.13 2005/08/08 16:42:54 christos Exp $";
+static char rcsid[] = "$NetBSD: lstDestroy.c,v 1.14 2005/08/09 21:36:42 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)lstDestroy.c       8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: lstDestroy.c,v 1.13 2005/08/08 16:42:54 christos Exp $");
+__RCSID("$NetBSD: lstDestroy.c,v 1.14 2005/08/09 21:36:42 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -68,7 +68,7 @@
  *-----------------------------------------------------------------------
  */
 void
-Lst_Destroy(Lst l, void (*freeProc)(ClientData))
+Lst_Destroy(Lst l, FreeProc *freeProc)
 {
     ListNode   ln;
     ListNode   tln = NilListNode;
@@ -93,7 +93,7 @@
     if (freeProc) {
        for (ln = list->firstPtr; ln != NilListNode; ln = tln) {
             tln = ln->nextPtr;
-            (*freeProc) (ln->datum);
+            freeProc(ln->datum);
             free(ln);
        }
     } else {
diff -r 759371dd4b5d -r 95de9207c0fb usr.bin/make/lst.lib/lstDupl.c
--- a/usr.bin/make/lst.lib/lstDupl.c    Tue Aug 09 21:25:42 2005 +0000
+++ b/usr.bin/make/lst.lib/lstDupl.c    Tue Aug 09 21:36:42 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lstDupl.c,v 1.12 2005/02/16 15:11:53 christos Exp $    */
+/*     $NetBSD: lstDupl.c,v 1.13 2005/08/09 21:36:42 christos Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -33,14 +33,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lstDupl.c,v 1.12 2005/02/16 15:11:53 christos Exp $";
+static char rcsid[] = "$NetBSD: lstDupl.c,v 1.13 2005/08/09 21:36:42 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)lstDupl.c  8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: lstDupl.c,v 1.12 2005/02/16 15:11:53 christos Exp $");
+__RCSID("$NetBSD: lstDupl.c,v 1.13 2005/08/09 21:36:42 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -71,7 +71,7 @@
  *-----------------------------------------------------------------------
  */
 Lst
-Lst_Duplicate(Lst l, ClientData (*copyProc)(ClientData))
+Lst_Duplicate(Lst l, DuplicateProc *copyProc)
 {
     Lst        nl;
     ListNode   ln;
@@ -89,7 +89,7 @@
     ln = list->firstPtr;
     while (ln != NilListNode) {
        if (copyProc != NOCOPY) {
-           if (Lst_AtEnd(nl, (*copyProc) (ln->datum)) == FAILURE) {
+           if (Lst_AtEnd(nl, copyProc(ln->datum)) == FAILURE) {
                return (NILLST);
            }
        } else if (Lst_AtEnd(nl, ln->datum) == FAILURE) {
diff -r 759371dd4b5d -r 95de9207c0fb usr.bin/make/main.c
--- a/usr.bin/make/main.c       Tue Aug 09 21:25:42 2005 +0000
+++ b/usr.bin/make/main.c       Tue Aug 09 21:36:42 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.115 2005/08/08 16:42:54 christos Exp $      */
+/*     $NetBSD: main.c,v 1.116 2005/08/09 21:36:42 christos Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.115 2005/08/08 16:42:54 christos Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.116 2005/08/09 21:36:42 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -81,7 +81,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.115 2005/08/08 16:42:54 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.116 2005/08/09 21:36:42 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1054,7 +1054,7 @@
        Lst_Destroy(targs, NOFREE);
        Lst_Destroy(variables, NOFREE);
        Lst_Destroy(makefiles, NOFREE);
-       Lst_Destroy(create, (void (*)(ClientData))) free;
+       Lst_Destroy(create, (FreeProc *)free);
 #endif
 
        /* print the graph now it's been processed if the user requested it */
diff -r 759371dd4b5d -r 95de9207c0fb usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Tue Aug 09 21:25:42 2005 +0000
+++ b/usr.bin/make/parse.c      Tue Aug 09 21:36:42 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.105 2005/08/08 16:42:54 christos Exp $     */
+/*     $NetBSD: parse.c,v 1.106 2005/08/09 21:36:42 christos Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.105 2005/08/08 16:42:54 christos Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.106 2005/08/09 21:36:42 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c    8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.105 2005/08/08 16:42:54 christos Exp $");
+__RCSID("$NetBSD: parse.c,v 1.106 2005/08/09 21:36:42 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2929,7 +2929,7 @@
 Parse_End(void)
 {
 #ifdef CLEANUP
-    Lst_Destroy(targCmds, (void (*)(ClientData))) free;
+    Lst_Destroy(targCmds, (FreeProc *)free);
     if (targets)
        Lst_Destroy(targets, NOFREE);
     Lst_Destroy(defIncPath, Dir_Destroy);



Home | Main Index | Thread Index | Old Index