]> granicus.if.org Git - graphviz/commitdiff
remove the use of NIL and friends
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 18 Dec 2020 01:53:07 +0000 (17:53 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 23 Jan 2021 21:03:20 +0000 (13:03 -0800)
NULL is more concise and more widely understood than the Graphviz-specific macro
NIL. We leave the definitions of NIL in case others are using these through the
public API.

64 files changed:
cmd/dot/dot.c
cmd/smyrna/viewport.c
cmd/tools/gv2gxl.c
cmd/tools/sccmap.c
doc/libgraph/sccmap.c
lib/cdt/dtclose.c
lib/cdt/dtdisc.c
lib/cdt/dtextract.c
lib/cdt/dtflatten.c
lib/cdt/dthash.c
lib/cdt/dthdr.h
lib/cdt/dtlist.c
lib/cdt/dtmethod.c
lib/cdt/dtopen.c
lib/cdt/dtrenew.c
lib/cdt/dtrestore.c
lib/cdt/dtstat.c
lib/cdt/dttree.c
lib/cdt/dtview.c
lib/cgraph/attr.c
lib/cgraph/cmpnd.c
lib/cgraph/edge.c
lib/cgraph/grammar.y
lib/cgraph/graph.c
lib/cgraph/id.c
lib/cgraph/imap.c
lib/cgraph/mem.c
lib/cgraph/node.c
lib/cgraph/obj.c
lib/cgraph/pend.c
lib/cgraph/rec.c
lib/cgraph/refstr.c
lib/cgraph/scan.l
lib/cgraph/subg.c
lib/cgraph/utils.c
lib/cgraph/write.c
lib/circogen/blockpath.c
lib/circogen/circularinit.c
lib/common/htmltable.c
lib/common/input.c
lib/dotgen/dotsplines.c
lib/gvc/gvevent.c
lib/gvc/gvplugin.c
lib/neatogen/constraint.c
lib/pathplan/cvt.c
lib/sfio/sfclose.c
lib/sfio/sfdisc.c
lib/sfio/sfexcept.c
lib/sfio/sfmode.c
lib/sfio/sfnew.c
lib/sfio/sfopen.c
lib/sfio/sfpkrd.c
lib/sfio/sfputr.c
lib/sfio/sfseek.c
lib/sfio/sfsetbuf.c
lib/sfio/sfstack.c
lib/sfio/sfswap.c
lib/sfio/sfsync.c
lib/sfio/sftable.c
lib/sfio/sftmp.c
lib/sfio/sfungetc.c
lib/sfio/sfvprintf.c
lib/sfio/sfvscanf.c
lib/sfio/sfwr.c

index 445fefb6b81545ff8edc756c9682b602a2a20a72..d9e22a39059e2608306c392d185cb42677beba26 100644 (file)
@@ -70,7 +70,7 @@ static graph_t *create_test_graph(void)
     char name[10];
 
     /* Create a new graph */
-    g = agopen("new_graph", Agdirected,NIL(Agdisc_t *));
+    g = agopen("new_graph", Agdirected,NULL);
 
     /* Add nodes */
     for (j = 0; j < NUMNODES; j++) {
index 378cc19acc3e22efbc719d192021665944a5b8d4..2ce9172eacfb3c427155eae7340d92e6474fb1db 100644 (file)
@@ -22,6 +22,7 @@
 #include <glade/glade.h>
 #include "gui.h"
 #include "menucallbacks.h"
+#include <stddef.h>
 #include <string.h>
 #include "glcompui.h"
 /* #include "topview.h" */
@@ -609,7 +610,7 @@ static Agraph_t *loadGraph(char *filename)
        g_print("Cannot open %s\n", filename);
        return 0;
     }
-    g = agread(input_file, NIL(Agdisc_t *));
+    g = agread(input_file, NULL);
     fclose (input_file);
     if (!g) {
        g_print("Cannot read graph in  %s\n", filename);
index 58ed04021341822f12c308eb7fa82f61c4f061b5..c12aa70b4d69de44428499d1e592c2984c143682 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "convert.h"
 #include <ctype.h>
+#include <stddef.h>
 
 #define SMALLBUF    128
 
@@ -73,10 +74,10 @@ static Dtdisc_t nameDisc = {
     offsetof(namev_t, link),
     (Dtmake_f) make_nitem,
     (Dtfree_f) free_nitem,
-    NIL(Dtcompar_f),
-    NIL(Dthash_f),
-    NIL(Dtmemory_f),
-    NIL(Dtevent_f)
+    NULL,
+    NULL,
+    NULL,
+    NULL
 };
 
 typedef struct {
@@ -94,12 +95,12 @@ static Dtdisc_t idDisc = {
     offsetof(idv_t, name),
     -1,
     offsetof(idv_t, link),
-    NIL(Dtmake_f),
+    NULL,
     (Dtfree_f) free_iditem,
-    NIL(Dtcompar_f),
-    NIL(Dthash_f),
-    NIL(Dtmemory_f),
-    NIL(Dtevent_f)
+    NULL,
+    NULL,
+    NULL,
+    NULL
 };
 
 typedef struct {
@@ -411,12 +412,12 @@ writeDict(Agraph_t * g, FILE * gxlFile, char *name, Dict_t * dict,
     Dict_t *view;
     Agsym_t *sym, *psym;
 
-    view = dtview(dict, NIL(Dict_t *));
+    view = dtview(dict, NULL);
     for (sym = (Agsym_t *) dtfirst(dict); sym;
         sym = (Agsym_t *) dtnext(dict, sym)) {
        if (!isGxlGrammar(sym->name)) {
            if (EMPTY(sym->defval)) {   /* try to skip empty str (default) */
-               if (view == NIL(Dict_t *))
+               if (view == NULL)
                    continue;   /* no parent */
                psym = (Agsym_t *) dtsearch(view, sym);
                /* assert(psym); */
@@ -456,7 +457,7 @@ writeDict(Agraph_t * g, FILE * gxlFile, char *name, Dict_t * dict,
            /* gxl attr; check for special cases like composites */
            if (strncmp(sym->name, GXL_COMP, GXL_COMP_LEN) == 0) {
                if (EMPTY(sym->defval)) {
-                   if (view == NIL(Dict_t *))
+                   if (view == NULL)
                        continue;
                    psym = (Agsym_t *) dtsearch(view, sym);
                    if (EMPTY(psym->defval))
@@ -527,8 +528,8 @@ writeHdr(gxlstate_t * stp, Agraph_t * g, FILE * gxlFile, int top)
        free(dynbuf);
        Level++;
     } else {
-       Tailport = agattr(g, AGEDGE, "tailport", NIL(char *));
-       Headport = agattr(g, AGEDGE, "headport", NIL(char *));
+       Tailport = agattr(g, AGEDGE, "tailport", NULL);
+       Headport = agattr(g, AGEDGE, "headport", NULL);
     }
 
 
index 29ab835daffda0bf6061ecdde74fc13d61f11977..bb4e4dd8ddfc189d919159114b7d557ececec5a1 100644 (file)
@@ -153,7 +153,7 @@ static void nodeInduce(Agraph_t * g, Agraph_t* map)
                Agraph_t* hscc = getscc(aghead(e));
                if (tscc && hscc)
                    agedge(map, getrep(tscc),
-                          getrep(hscc), NIL(char *), TRUE);
+                          getrep(hscc), NULL, TRUE);
            }
        }
     }
index e5334294b54175a416176313bb44931b27190c1c..390ddd8c5e54a43c88c9bef308f650e90eef7e66 100644 (file)
@@ -106,7 +106,7 @@ static void nodeInduce(Agraph_t * g, Agraph_t * map)
                                Agraph_t *hscc = getscc(aghead(e));
                                if (tscc && hscc)
                                        agedge(map, getrep(tscc),
-                                                  getrep(hscc), NIL(char *), TRUE);
+                                                  getrep(hscc), NULL, TRUE);
                        }
                }
        }
index b945f05cf3083004447cfddf56cf3550d3dbd7a4..3e089d5dea9e7a89369d49f971474b35a80b373e 100644 (file)
@@ -1,4 +1,5 @@
 #include       <cdt/dthdr.h>
+#include       <stddef.h>
 
 /*     Close a dictionary
 **
@@ -15,14 +16,14 @@ int dtclose(Dt_t* dt)
        /* announce the close event to see if we should continue */
        disc = dt->disc;
        if(disc->eventf &&
-          (ev = (*disc->eventf)(dt,DT_CLOSE,NIL(void*),disc)) < 0)
+          (ev = (*disc->eventf)(dt,DT_CLOSE,NULL,disc)) < 0)
                return -1;
 
        if(dt->view)    /* turn off viewing */
-               dtview(dt,NIL(Dt_t*));
+               dtview(dt,NULL);
 
        if(ev == 0) /* release all allocated data */
-       {       (void)(*(dt->meth->searchf))(dt,NIL(void*),DT_CLEAR);
+       {       (void)(*(dt->meth->searchf))(dt,NULL,DT_CLEAR);
                if(dtsize(dt) > 0)
                        return -1;
 
@@ -37,7 +38,7 @@ int dtclose(Dt_t* dt)
                (*dt->memoryf)(dt, (void*)dt, 0, disc);
 
        if(disc->eventf)
-               (void)(*disc->eventf)(dt, DT_ENDCLOSE, NIL(void*), disc);
+               (void)(*disc->eventf)(dt, DT_ENDCLOSE, NULL, disc);
 
        return 0;
 }
index b8131f404c0d2b90e8ffcdde38d30aa3c019f2b4..72c4adfbbec41614f7daf5cd6f41126ae6d025fd 100644 (file)
@@ -1,4 +1,5 @@
 #include       <cdt/dthdr.h>
+#include       <stddef.h>
 
 /*     Change discipline.
 **     dt :    dictionary
@@ -12,11 +13,11 @@ static void* dtmemory(Dt_t* dt,void* addr,size_t size,Dtdisc_t* disc)
        if(addr)
        {       if(size == 0)
                {       free(addr);
-                       return NIL(void*);
+                       return NULL;
                }
                else    return realloc(addr,size);
        }
-       else    return size > 0 ? malloc(size) : NIL(void*);
+       else    return size > 0 ? malloc(size) : NULL;
 }
 
 Dtdisc_t* dtdisc(Dt_t* dt, Dtdisc_t* disc, int type)
@@ -41,7 +42,7 @@ Dtdisc_t* dtdisc(Dt_t* dt, Dtdisc_t* disc, int type)
        UNFLATTEN(dt);
 
        if(old->eventf && (*old->eventf)(dt,DT_DISC,(void*)disc,old) < 0)
-               return NIL(Dtdisc_t*);
+               return NULL;
 
        dt->disc = disc;
        if(!(dt->memoryf = disc->memoryf) )
@@ -65,14 +66,14 @@ Dtdisc_t* dtdisc(Dt_t* dt, Dtdisc_t* disc, int type)
        dt_renew:
                r = dtflatten(dt);
                dt->data->type &= ~DT_FLATTEN;
-               dt->data->here = NIL(Dtlink_t*);
+               dt->data->here = NULL;
                dt->data->size = 0;
 
                if(dt->data->type&(DT_SET|DT_BAG))
                {       Dtlink_t        **s, **ends;
                        ends = (s = dt->data->htab) + dt->data->ntab;
                        while(s < ends)
-                               *s++ = NIL(Dtlink_t*);
+                               *s++ = NULL;
                }
 
                /* reinsert them */
index 3573b8afd3f18d2c1018940c506da45c476ad249..22730060bea8a53694e74654a1aaa693183e2c19 100644 (file)
@@ -1,4 +1,5 @@
 #include       <cdt/dthdr.h>
+#include       <stddef.h>
 
 /*     Extract objects of a dictionary.
 **
@@ -14,16 +15,16 @@ Dtlink_t* dtextract(Dt_t* dt)
        else if(dt->data->type&(DT_SET|DT_BAG))
        {       list = dtflatten(dt);
                for(ends = (s = dt->data->htab) + dt->data->ntab; s < ends; ++s)
-                       *s = NIL(Dtlink_t*);
+                       *s = NULL;
        }
        else /*if(dt->data->type&(DT_LIST|DT_STACK|DT_QUEUE))*/
        {       list = dt->data->head;
-               dt->data->head = NIL(Dtlink_t*);
+               dt->data->head = NULL;
        }
 
        dt->data->type &= ~DT_FLATTEN;
        dt->data->size = 0;
-       dt->data->here = NIL(Dtlink_t*);
+       dt->data->here = NULL;
 
        return list;
 }
index ea928f3c70c330daa14aa0e079d83b707fdd170b..9e07aca97911e1a07f9516d095e8070c97da30f9 100644 (file)
@@ -1,4 +1,5 @@
 #include       <cdt/dthdr.h>
+#include       <stddef.h>
 
 /*     Flatten a dictionary into a linked list.
 **     This may be used when many traversals are likely.
@@ -14,7 +15,7 @@ Dtlink_t* dtflatten(Dt_t* dt)
        if(dt->data->type&DT_FLATTEN )
                return dt->data->here;
 
-       list = last = NIL(Dtlink_t*);
+       list = last = NULL;
        if(dt->data->type&(DT_SET|DT_BAG))
        {       for(ends = (s = dt->data->htab) + dt->data->ntab; s < ends; ++s)
                {       if((t = *s) )
index 76b7ea6d0dcd23ee96642242dd31ba759b607902..7999185198688a7f3d5e91b669ef2cc91955310e 100644 (file)
@@ -1,4 +1,5 @@
 #include       <cdt/dthdr.h>
+#include       <stddef.h>
 
 /*     Hash table.
 **     dt:     dictionary
@@ -45,7 +46,7 @@ static void dthtab(Dt_t* dt)
                return;
 
        /* allocate new table */
-       olds = dt->data->ntab == 0 ? NIL(Dtlink_t**) : dt->data->htab;
+       olds = dt->data->ntab == 0 ? NULL : dt->data->htab;
        if(!(s = (Dtlink_t**)(*dt->memoryf)(dt,olds,n*sizeof(Dtlink_t*),dt->disc)) )
                return;
        olds = s + dt->data->ntab;
@@ -54,9 +55,9 @@ static void dthtab(Dt_t* dt)
 
        /* rehash elements */
        for(hs = s+n-1; hs >= olds; --hs)
-               *hs = NIL(Dtlink_t*);
+               *hs = NULL;
        for(hs = s; hs < olds; ++hs)
-       {       for(p = NIL(Dtlink_t*), t = *hs; t; t = r)
+       {       for(p = NULL, t = *hs; t; t = r)
                {       r = t->right;
                        if((is = s + HINDEX(n,t->hash)) == hs)
                                p = t;
@@ -91,14 +92,14 @@ static void* dthash(Dt_t* dt, void* obj, int type)
                        goto end_walk;
 
                if(dt->data->size <= 0 || !(type&(DT_CLEAR|DT_FIRST|DT_LAST)) )
-                       return NIL(void*);
+                       return NULL;
 
                ends = (s = dt->data->htab) + dt->data->ntab;
                if(type&DT_CLEAR)
                {       /* clean out all objects */
                        for(; s < ends; ++s)
                        {       t = *s;
-                               *s = NIL(Dtlink_t*);
+                               *s = NULL;
                                if(!disc->freef && disc->link >= 0)
                                        continue;
                                while(t)
@@ -110,13 +111,13 @@ static void* dthash(Dt_t* dt, void* obj, int type)
                                        t = r;
                                }
                        }
-                       dt->data->here = NIL(Dtlink_t*);
+                       dt->data->here = NULL;
                        dt->data->size = 0;
                        dt->data->loop = 0;
-                       return NIL(void*);
+                       return NULL;
                }
                else    /* computing the first/last object */
-               {       t = NIL(Dtlink_t*);
+               {       t = NULL;
                        while(s < ends && !t )
                                t = (type&DT_LAST) ? *--ends : *s++;
                        if(t && (type&DT_LAST))
@@ -125,18 +126,18 @@ static void* dthash(Dt_t* dt, void* obj, int type)
 
                        dt->data->loop += 1;
                        dt->data->here = t;
-                       return t ? _DTOBJ(t,lk) : NIL(void*);
+                       return t ? _DTOBJ(t,lk) : NULL;
                }
        }
 
        /* allow apps to delete an object "actually" in the dictionary */
        if(dt->meth->type == DT_BAG && (type&(DT_DELETE|DT_DETACH)) )
        {       if(!dtsearch(dt,obj) )
-                       return NIL(void*);
+                       return NULL;
 
                s = dt->data->htab + HINDEX(dt->data->ntab,dt->data->here->hash);
-               r = NIL(Dtlink_t*);
-               for(p = NIL(Dtlink_t*), t = *s; t; p = t, t = t->right)
+               r = NULL;
+               for(p = NULL, t = *s; t; p = t, t = t->right)
                {       if(_DTOBJ(t,lk) == obj) /* delete this specific object */
                                goto do_delete;
                        if(t == dt->data->here)
@@ -164,15 +165,15 @@ static void* dthash(Dt_t* dt, void* obj, int type)
        {       if((t = dt->data->here) && _DTOBJ(t,lk) == obj)
                {       hsh = t->hash;
                        s = dt->data->htab + HINDEX(dt->data->ntab,hsh);
-                       p = NIL(Dtlink_t*);
+                       p = NULL;
                }
                else
                {       key = _DTKEY(obj,ky,sz);
                        hsh = _DTHSH(dt,key,disc,sz);
                do_search:
-                       t = dt->data->ntab <= 0 ? NIL(Dtlink_t*) :
+                       t = dt->data->ntab <= 0 ? NULL :
                                *(s = dt->data->htab + HINDEX(dt->data->ntab,hsh));
-                       for(p = NIL(Dtlink_t*); t; p = t, t = t->right)
+                       for(p = NULL; t; p = t, t = t->right)
                        {       if(hsh == t->hash)
                                {       k = _DTOBJ(t,lk); k = _DTKEY(k,ky,sz);
                                        if(_DTCMP(dt,key,k,disc,cmpf,sz) == 0)
@@ -187,7 +188,7 @@ static void* dthash(Dt_t* dt, void* obj, int type)
 
        if(type&(DT_MATCH|DT_SEARCH|DT_VSEARCH))
        {       if(!t)
-                       return NIL(void*);
+                       return NULL;
                if(p && (dt->data->type&DT_SET) && dt->data->loop <= 0)
                {       /* move-to-front heuristic */
                        p->right = t->right;
@@ -205,18 +206,18 @@ static void* dthash(Dt_t* dt, void* obj, int type)
 
                if(disc->makef && (type&DT_INSERT) &&
                   !(obj = (*disc->makef)(dt,obj,disc)) )
-                       return NIL(void*);
+                       return NULL;
                if(lk >= 0)
                        r = _DTLNK(obj,lk);
                else
                {       r = (Dtlink_t*)(*dt->memoryf)
-                               (dt,NIL(void*),sizeof(Dthold_t),disc);
+                               (dt,NULL,sizeof(Dthold_t),disc);
                        if(r)
                                ((Dthold_t*)r)->obj = obj;
                        else
                        {       if(disc->makef && disc->freef && (type&DT_INSERT))
                                        (*disc->freef)(dt,obj,disc);
-                               return NIL(void*);
+                               return NULL;
                        }
                }
                r->hash = hsh;
@@ -231,7 +232,7 @@ static void* dthash(Dt_t* dt, void* obj, int type)
                                (*disc->freef)(dt,obj,disc);
                        if(disc->link < 0)
                                (*disc->memoryf)(dt,(void*)r,0,disc);
-                       return NIL(void*);
+                       return NULL;
                }
                s = dt->data->htab + HINDEX(dt->data->ntab,hsh);
                if(t)
@@ -260,7 +261,7 @@ static void* dthash(Dt_t* dt, void* obj, int type)
                                        p = p->right;
                        }
                        else
-                       {       p = NIL(Dtlink_t*);
+                       {       p = NULL;
                                for(s -= 1, ends = dt->data->htab; s >= ends; --s)
                                {       if((p = *s) )
                                        {       while(p->right)
@@ -277,7 +278,7 @@ static void* dthash(Dt_t* dt, void* obj, int type)
                                dt->data->loop = 0;
                        if(dt->data->size > HLOAD(dt->data->ntab) && dt->data->loop <= 0)
                                dthtab(dt);
-                       return NIL(void*);
+                       return NULL;
                }
                else
                {       dt->data->type |= DT_WALK;
@@ -292,14 +293,14 @@ static void* dthash(Dt_t* dt, void* obj, int type)
                                (*disc->freef)(dt,obj,disc);
                        if(disc->link < 0)
                                (*dt->memoryf)(dt,(void*)r,0,disc);
-                       return t ? _DTOBJ(t,lk) : NIL(void*);
+                       return t ? _DTOBJ(t,lk) : NULL;
                }
        }
        else /*if(type&(DT_DELETE|DT_DETACH))*/
        {       /* take an element out of the dictionary */
        do_delete:
                if(!t)
-                       return NIL(void*);
+                       return NULL;
                else if(p)
                        p->right = t->right;
                else if((p = *s) == t)
index 6972eebe38821b2a7bd02ec8441f9e3e01799bf9..bb03b01f387f0f701886a4c42dc6eb94bc660441 100644 (file)
@@ -35,7 +35,7 @@
 #define HINDEX(n,h)    ((h)&((n)-1))
 
 #define UNFLATTEN(dt) \
-               ((dt->data->type&DT_FLATTEN) ? dtrestore(dt,NIL(Dtlink_t*)) : 0)
+               ((dt->data->type&DT_FLATTEN) ? dtrestore(dt,NULL) : 0)
 
 /* tree rotation/linking functions */
 #define rrotate(x,y)   ((x)->left  = (y)->right, (y)->right = (x))
index 07fc2b5abb78b2e9077789db120e1acf2282503c..9d37ea1438a0e24e93913f2aff1fbdd461381b65 100644 (file)
@@ -1,4 +1,5 @@
 #include       <cdt/dthdr.h>
+#include       <stddef.h>
 
 /*     List, Deque, Stack, Queue.
 **
@@ -24,11 +25,11 @@ static void* dtlist(Dt_t* dt, void* obj, int type)
                                        r = r->left;
                                dt->data->here = r;
                        }
-                       return r ? _DTOBJ(r,lk) : NIL(void*);
+                       return r ? _DTOBJ(r,lk) : NULL;
                }
                else if(type&(DT_DELETE|DT_DETACH))
                {       if((dt->data->type&(DT_LIST|DT_DEQUE)) || !(r = dt->data->head))
-                               return NIL(void*);
+                               return NULL;
                        else    goto dt_delete;
                }
                else if(type&DT_CLEAR)
@@ -41,28 +42,28 @@ static void* dtlist(Dt_t* dt, void* obj, int type)
                                                (*dt->memoryf)(dt,(void*)r,0,disc);
                                }
                        }
-                       dt->data->head = dt->data->here = NIL(Dtlink_t*);
+                       dt->data->head = dt->data->here = NULL;
                        dt->data->size = 0;
-                       return NIL(void*);
+                       return NULL;
                }
-               else    return NIL(void*);
+               else    return NULL;
        }
 
        if(type&(DT_INSERT|DT_ATTACH))
        {       if(disc->makef && (type&DT_INSERT) &&
                   !(obj = (*disc->makef)(dt,obj,disc)) )
-                       return NIL(void*);
+                       return NULL;
                if(lk >= 0)
                        r = _DTLNK(obj,lk);
                else
                {       r = (Dtlink_t*)(*dt->memoryf)
-                               (dt,NIL(void*),sizeof(Dthold_t),disc);
+                               (dt,NULL,sizeof(Dthold_t),disc);
                        if(r)
                                ((Dthold_t*)r)->obj = obj;
                        else
                        {       if(disc->makef && disc->freef && (type&DT_INSERT))
                                        (*disc->freef)(dt,obj,disc);
-                               return NIL(void*);
+                               return NULL;
                        }
                }
 
@@ -110,7 +111,7 @@ static void* dtlist(Dt_t* dt, void* obj, int type)
                        {       dt->data->head = r;
                                r->left = r;
                        }
-                       r->right = NIL(Dtlink_t*);
+                       r->right = NULL;
                }
 
                if(dt->data->size >= 0)
@@ -130,7 +131,7 @@ static void* dtlist(Dt_t* dt, void* obj, int type)
        }
 
        if(!r)
-               return NIL(void*);
+               return NULL;
        dt->type |= DT_FOUND;
 
        if(type&(DT_DELETE|DT_DETACH))
@@ -148,7 +149,7 @@ static void* dtlist(Dt_t* dt, void* obj, int type)
                                t->left = r->left;
                }
 
-               dt->data->here = r == dt->data->here ? r->right : NIL(Dtlink_t*);
+               dt->data->here = r == dt->data->here ? r->right : NULL;
                dt->data->size -= 1;
 
                obj = _DTOBJ(r,lk);
@@ -161,10 +162,10 @@ static void* dtlist(Dt_t* dt, void* obj, int type)
        else if(type&DT_NEXT)
                r = r->right;
        else if(type&DT_PREV)
-               r = r == dt->data->head ? NIL(Dtlink_t*) : r->left;
+               r = r == dt->data->head ? NULL : r->left;
 
        dt->data->here = r;
-       return r ? _DTOBJ(r,lk) : NIL(void*);
+       return r ? _DTOBJ(r,lk) : NULL;
 }
 
 #ifndef KPVDEL /* to be remove next round */
index a03e00ce99fad79bba14771f4bd59d1b35756b4c..03c912d729225810fddfd4195ae478e506587071 100644 (file)
@@ -1,4 +1,5 @@
 #include       <cdt/dthdr.h>
+#include       <stddef.h>
 
 /*     Change search method.
 **
@@ -16,7 +17,7 @@ Dtmethod_t* dtmethod(Dt_t* dt, Dtmethod_t* meth)
 
        if(disc->eventf &&
           (*disc->eventf)(dt,DT_METH,(void*)meth,disc) < 0)
-               return NIL(Dtmethod_t*);
+               return NULL;
 
        dt->data->minp = 0;
 
@@ -24,15 +25,15 @@ Dtmethod_t* dtmethod(Dt_t* dt, Dtmethod_t* meth)
        list = dtflatten(dt);
 
        if(dt->data->type&(DT_LIST|DT_STACK|DT_QUEUE) )
-               dt->data->head = NIL(Dtlink_t*);
+               dt->data->head = NULL;
        else if(dt->data->type&(DT_SET|DT_BAG) )
        {       if(dt->data->ntab > 0)
                        (*dt->memoryf)(dt,(void*)dt->data->htab,0,disc);
                dt->data->ntab = 0;
-               dt->data->htab = NIL(Dtlink_t**);
+               dt->data->htab = NULL;
        }
 
-       dt->data->here = NIL(Dtlink_t*);
+       dt->data->here = NULL;
        dt->data->type = (dt->data->type&~(DT_METHODS|DT_FLATTEN)) | meth->type;
        dt->meth = meth;
        if(dt->searchf == oldmeth->searchf)
index 4f6ac9d895d1773c208bdb3a145f293c204671c3..ebe56a3693bb0c5f71cf8acbf475dbf182d9b6ab 100644 (file)
@@ -1,4 +1,5 @@
 #include       <cdt/dthdr.h>
+#include       <stddef.h>
 
 /*     Make a new dictionary
 **
@@ -12,25 +13,25 @@ Dt_t* dtopen(Dtdisc_t* disc, Dtmethod_t* meth)
        Dtdata_t*       data;
 
        if(!disc || !meth)
-               return NIL(Dt_t*);
+               return NULL;
 
        /* allocate space for dictionary */
        if(!(dt = malloc(sizeof(Dt_t))))
-               return NIL(Dt_t*);
+               return NULL;
 
        /* initialize all absolutely private data */
-       dt->searchf = NIL(Dtsearch_f);
-       dt->meth = NIL(Dtmethod_t*);
-       dt->disc = NIL(Dtdisc_t*);
+       dt->searchf = NULL;
+       dt->meth = NULL;
+       dt->disc = NULL;
        dtdisc(dt,disc,0);
        dt->type = DT_MALLOC;
        dt->nview = 0;
-       dt->view = dt->walk = NIL(Dt_t*);
-       dt->user = NIL(void*);
+       dt->view = dt->walk = NULL;
+       dt->user = NULL;
 
        if(disc->eventf)
        {       /* if shared/persistent dictionary, get existing data */
-               data = NIL(Dtdata_t*);
+               data = NULL;
                if((e = (*disc->eventf)(dt,DT_OPEN,(void*)(&data),disc)) < 0)
                        goto err_open;
                else if(e > 0)
@@ -45,27 +46,27 @@ Dt_t* dtopen(Dtdisc_t* disc, Dtmethod_t* meth)
 
                        free(dt);
                        if(!(dt = (*disc->memoryf)(0, 0, sizeof(Dt_t), disc)) )
-                               return NIL(Dt_t*);
-                       dt->searchf = NIL(Dtsearch_f);
-                       dt->meth = NIL(Dtmethod_t*);
-                       dt->disc = NIL(Dtdisc_t*);
+                               return NULL;
+                       dt->searchf = NULL;
+                       dt->meth = NULL;
+                       dt->disc = NULL;
                        dtdisc(dt,disc,0);
                        dt->type = DT_MEMORYF;
                        dt->nview = 0;
-                       dt->view = dt->walk = NIL(Dt_t*);
+                       dt->view = dt->walk = NULL;
                }
        }
 
        /* allocate sharable data */
-       if(!(data = (Dtdata_t*)(dt->memoryf)(dt,NIL(void*),sizeof(Dtdata_t),disc)) )
+       if(!(data = (Dtdata_t*)(dt->memoryf)(dt,NULL,sizeof(Dtdata_t),disc)) )
        { err_open:
                free(dt);
-               return NIL(Dt_t*);
+               return NULL;
        }
 
        data->type = meth->type;
-       data->here = NIL(Dtlink_t*);
-       data->htab = NIL(Dtlink_t**);
+       data->here = NULL;
+       data->htab = NULL;
        data->ntab = data->size = data->loop = 0;
        data->minp = 0;
 
index 44c14f86c4fb932a5c6c0bf7634d47cbfe11d3bb..d7db5051dfe7321cfaf92ef3acf147c759057aef 100644 (file)
@@ -1,5 +1,5 @@
 #include       <cdt/dthdr.h>
-
+#include       <stddef.h>
 
 /*     Renew the object at the current finger.
 **
@@ -15,7 +15,7 @@ void* dtrenew(Dt_t* dt, void* obj)
        UNFLATTEN(dt);
 
        if(!(e = dt->data->here) || _DTOBJ(e,disc->link) != obj)
-               return NIL(void*);
+               return NULL;
 
        if(dt->data->type&(DT_STACK|DT_QUEUE|DT_LIST))
                return obj;
@@ -44,9 +44,9 @@ void* dtrenew(Dt_t* dt, void* obj)
                }
                key = _DTKEY(obj,disc->key,disc->size);
                e->hash = _DTHSH(dt,key,disc,disc->size);
-               dt->data->here = NIL(Dtlink_t*);
+               dt->data->here = NULL;
        }
 
        dt->data->size -= 1;
-       return (*dt->meth->searchf)(dt,(void*)e,DT_RENEW) ? obj : NIL(void*);
+       return (*dt->meth->searchf)(dt,(void*)e,DT_RENEW) ? obj : NULL;
 }
index e2ae73cc7c58b418a76b4cb65eff66761e6eab0d..1b00d8a06f79846e7c873b15272976d441e51fc2 100644 (file)
@@ -1,4 +1,5 @@
 #include       <cdt/dthdr.h>
+#include       <stddef.h>
 
 /*     Restore dictionary from given tree or list of elements.
 **     There are two cases. If called from within, list is nil.
@@ -27,13 +28,13 @@ int dtrestore(Dt_t* dt, Dtlink_t* list)
        dt->data->type &= ~DT_FLATTEN;
 
        if(dt->data->type&(DT_SET|DT_BAG))
-       {       dt->data->here = NIL(Dtlink_t*);
+       {       dt->data->here = NULL;
                if(type) /* restoring a flattened dictionary */
                {       for(ends = (s = dt->data->htab) + dt->data->ntab; s < ends; ++s)
                        {       if((t = *s) )
                                {       *s = list;
                                        list = t->right;
-                                       t->right = NIL(Dtlink_t*);
+                                       t->right = NULL;
                                }
                        }
                }
@@ -50,7 +51,7 @@ int dtrestore(Dt_t* dt, Dtlink_t* list)
        {       if(dt->data->type&(DT_OSET|DT_OBAG))
                        dt->data->here = list;
                else /*if(dt->data->type&(DT_LIST|DT_STACK|DT_QUEUE))*/
-               {       dt->data->here = NIL(Dtlink_t*);
+               {       dt->data->here = NULL;
                        dt->data->head = list;
                }
                if(!type)
index 8f25d6042be9126be29d7aaac4bcbe7cec4b65a6..5c40fb1dcacc415b81756f0477fabf29fa48873c 100644 (file)
@@ -1,4 +1,5 @@
 #include       <cdt/dthdr.h>
+#include       <stddef.h>
 
 /*     Get statistics of a dictionary
 **
@@ -44,7 +45,7 @@ int dtstat(Dt_t* dt, Dtstat_t* ds, int all)
        UNFLATTEN(dt);
 
        ds->dt_n = ds->dt_max = 0;
-       ds->dt_count = NIL(int*);
+       ds->dt_count = NULL;
        ds->dt_size = dtsize(dt);
        ds->dt_meth = dt->data->type&DT_METHODS;
 
@@ -52,7 +53,7 @@ int dtstat(Dt_t* dt, Dtstat_t* ds, int all)
                return 0;
 
        if(dt->data->type&(DT_SET|DT_BAG))
-       {       dthstat(dt->data,ds,NIL(int*));
+       {       dthstat(dt->data,ds,NULL);
                if(ds->dt_max+1 > Size)
                {       if(Size > 0)
                                free(Count);
@@ -66,7 +67,7 @@ int dtstat(Dt_t* dt, Dtstat_t* ds, int all)
        }
        else if(dt->data->type&(DT_OSET|DT_OBAG))
        {       if(dt->data->here)
-               {       dttstat(ds,dt->data->here,0,NIL(int*));
+               {       dttstat(ds,dt->data->here,0,NULL);
                        if(ds->dt_n+1 > Size)
                        {       if(Size > 0)
                                        free(Count);
index c2de68c4508db1cd43c7ad0d2a48721de4443798..0f9ad525b5c0d27c697e17a99fa8be7b8ad6a19a 100644 (file)
@@ -1,4 +1,5 @@
 #include       <cdt/dthdr.h>
+#include       <stddef.h>
 
 /*     Ordered set/multiset
 **     dt:     dictionary being searched
@@ -25,7 +26,7 @@ static void* dttree(Dt_t* dt, void* obj, int type)
        root = dt->data->here;
        if(!obj)
        {       if(!root || !(type&(DT_CLEAR|DT_FIRST|DT_LAST)) )
-                       return NIL(void*);
+                       return NULL;
 
                if(type&DT_CLEAR) /* delete all objects */
                {       if(disc->freef || disc->link < 0)
@@ -41,8 +42,8 @@ static void* dttree(Dt_t* dt, void* obj, int type)
                        }
 
                        dt->data->size = 0;
-                       dt->data->here = NIL(Dtlink_t*);
-                       return NIL(void*);
+                       dt->data->here = NULL;
+                       return NULL;
                }
                else /* computing largest/smallest element */
                {       if(type&DT_LAST)
@@ -103,7 +104,7 @@ static void* dttree(Dt_t* dt, void* obj, int type)
                                else
                                {       turn[n] = cmp;  
                                        if(!(t = cmp < 0 ? t->left : t->right) )
-                                               return NIL(void*);
+                                               return NULL;
                                }
                        }
 
@@ -165,7 +166,7 @@ static void* dttree(Dt_t* dt, void* obj, int type)
                                }
                                else
                                {       rlink(r,root);
-                                       root = NIL(Dtlink_t*);
+                                       root = NULL;
                                        break;
                                }
                        }
@@ -192,7 +193,7 @@ static void* dttree(Dt_t* dt, void* obj, int type)
                                }
                                else
                                {       llink(l,root);
-                                       root = NIL(Dtlink_t*);
+                                       root = NULL;
                                        break;
                                }
                        }
@@ -229,7 +230,7 @@ static void* dttree(Dt_t* dt, void* obj, int type)
                }
                else if(type&DT_NEXT)
                {       root->left = link.right;
-                       root->right = NIL(Dtlink_t*);
+                       root->right = NULL;
                        link.right = root;
                dt_next:
                        if((root = link.left) ) 
@@ -242,7 +243,7 @@ static void* dttree(Dt_t* dt, void* obj, int type)
                }
                else if(type&DT_PREV)
                {       root->right = link.left;
-                       root->left = NIL(Dtlink_t*);
+                       root->left = NULL;
                        link.left = root;
                dt_prev:
                        if((root = link.right) )
@@ -269,7 +270,7 @@ static void* dttree(Dt_t* dt, void* obj, int type)
                {       if(dt->meth->type&DT_OSET)
                                goto has_root;
                        else
-                       {       root->left = NIL(Dtlink_t*);
+                       {       root->left = NULL;
                                root->right = link.left;
                                link.left = root;
                                goto dt_insert;
@@ -283,7 +284,7 @@ static void* dttree(Dt_t* dt, void* obj, int type)
                                        (*dt->memoryf)(dt,(void*)me,0,disc);
                        }
                        else
-                       {       me->left = NIL(Dtlink_t*);
+                       {       me->left = NULL;
                                me->right = link.left;
                                link.left = me;
                                dt->data->size += 1;
@@ -293,8 +294,8 @@ static void* dttree(Dt_t* dt, void* obj, int type)
        }
        else
        {       /* not found, finish up LEFT and RIGHT trees */
-               r->left = NIL(Dtlink_t*);
-               l->right = NIL(Dtlink_t*);
+               r->left = NULL;
+               l->right = NULL;
 
                if(type&DT_NEXT)
                        goto dt_next;
@@ -306,7 +307,7 @@ static void* dttree(Dt_t* dt, void* obj, int type)
                                r = t;
                        r->left = link.right;
                        dt->data->here = link.left;
-                       return (type&DT_DELETE) ? obj : NIL(void*);
+                       return (type&DT_DELETE) ? obj : NULL;
                }
                else if(type&(DT_INSERT|DT_ATTACH))
                { dt_insert:
@@ -317,7 +318,7 @@ static void* dttree(Dt_t* dt, void* obj, int type)
                                        root = _DTLNK(obj,lk);
                                else
                                {       root = (Dtlink_t*)(*dt->memoryf)
-                                               (dt,NIL(void*),sizeof(Dthold_t),disc);
+                                               (dt,NULL,sizeof(Dthold_t),disc);
                                        if(root)
                                                ((Dthold_t*)root)->obj = obj;
                                        else if(disc->makef && disc->freef &&
@@ -338,12 +339,12 @@ static void* dttree(Dt_t* dt, void* obj, int type)
                        goto has_root;
                }
                else /*if(type&DT_DELETE)*/
-               {       obj = NIL(void*);
+               {       obj = NULL;
                        goto no_root;
                }
        }
 
-       return NIL(void*);
+       return NULL;
 }
 
 /* make this method available */
index 5f4f13ffe383694af30fb5aefa864d8d1b108e80..8e2a3998785367decf5641d51526d7b312b0432f 100644 (file)
@@ -1,4 +1,5 @@
 #include       <cdt/dthdr.h>
+#include       <stddef.h>
 
 /*     Set a view path from dict to view.
 **
@@ -29,9 +30,9 @@ static void* dtvsearch(Dt_t* dt, void* obj, int type)
 
        if(dt->meth->type & (DT_OBAG|DT_OSET) )
        {       if(!(type & (DT_FIRST|DT_LAST|DT_NEXT|DT_PREV)) )
-                       return NIL(void*);
+                       return NULL;
 
-               n = nk = NIL(void*); p = NIL(Dt_t*);
+               n = nk = NULL; p = NULL;
                for(d = dt; d; d = d->view)
                {       if(!(o = (*d->meth->searchf)(d, obj, type)) )
                                continue;
@@ -57,7 +58,7 @@ static void* dtvsearch(Dt_t* dt, void* obj, int type)
 
        /* non-ordered methods */
        if(!(type & (DT_NEXT|DT_PREV)) )
-               return NIL(void*);
+               return NULL;
 
        if(!dt->walk || obj != _DTOBJ(dt->walk->data->here, dt->walk->disc->link) )
        {       for(d = dt; d; d = d->view)
@@ -65,7 +66,7 @@ static void* dtvsearch(Dt_t* dt, void* obj, int type)
                                break;
                dt->walk = d;
                if(!(obj = o) )
-                       return NIL(void*);
+                       return NULL;
        }
 
        for(d = dt->walk, obj = (*d->meth->searchf)(d, obj, type);; )
@@ -80,10 +81,10 @@ static void* dtvsearch(Dt_t* dt, void* obj, int type)
                }
 
                if(!(d = dt->walk = d->view) ) /* move on to next dictionary */
-                       return NIL(void*);
+                       return NULL;
                else if(type&DT_NEXT)
-                       obj = (*(d->meth->searchf))(d,NIL(void*),DT_FIRST);
-               else    obj = (*(d->meth->searchf))(d,NIL(void*),DT_LAST);
+                       obj = (*(d->meth->searchf))(d,NULL,DT_FIRST);
+               else    obj = (*(d->meth->searchf))(d,NULL,DT_LAST);
        }
 }
 
@@ -95,18 +96,18 @@ Dt_t* dtview(Dt_t* dt, Dt_t* view)
        if(view)
        {       UNFLATTEN(view);
                if(view->meth != dt->meth) /* must use the same method */
-                       return NIL(Dt_t*);
+                       return NULL;
        }
 
        /* make sure there won't be a cycle */
        for(d = view; d; d = d->view)
                if(d == dt)
-                       return NIL(Dt_t*);
+                       return NULL;
 
        /* no more viewing lower dictionary */
        if((d = dt->view) )
                d->nview -= 1;
-       dt->view = dt->walk = NIL(Dt_t*);
+       dt->view = dt->walk = NULL;
 
        if(!view)
        {       dt->searchf = dt->meth->searchf;
index ef120ded929e4ca296ddd69b0b0fed9404c7aa6a..ce10c4950e77c17756a29c626f71cdd9179344f4 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <cgraph/cghdr.h>
+#include       <stddef.h>
 
 /*
  * dynamic attributes
@@ -27,12 +28,12 @@ Dtdisc_t AgDataDictDisc = {
     (int) offsetof(Agsym_t, name),     /* use symbol name as key */
     -1,
     (int) offsetof(Agsym_t, link),
-    NIL(Dtmake_f),
+    NULL,
     freesym,
-    NIL(Dtcompar_f),
-    NIL(Dthash_f),
-    NIL(Dtmemory_f),
-    NIL(Dtevent_f),
+    NULL,
+    NULL,
+    NULL,
+    NULL,
 };
 
 static char DataDictName[] = "_AG_datadict";
@@ -71,10 +72,10 @@ static Dict_t *agdictof(Agraph_t * g, int kind)
            break;
        default:
            agerr(AGERR,"agdictof: unknown kind %d\n", kind);
-           dict = NIL(Dict_t *);
+           dict = NULL;
            break;
     } else
-       dict = NIL(Dict_t *);
+       dict = NULL;
     return dict;
 }
 
@@ -146,7 +147,7 @@ static Agsym_t *aglocaldictsym(Dict_t * dict, char *name)
     Agsym_t *rv;
     Dict_t *view;
 
-    view = dtview(dict, NIL(Dict_t *));
+    view = dtview(dict, NULL);
     rv = agdictsym(dict, name);
     dtview(dict, view);
     return rv;
@@ -162,7 +163,7 @@ Agsym_t *agattrsym(void *obj, char *name)
     if (data)
        rv = agdictsym(data->dict, arg);
     else
-       rv = NILsym;
+       rv = NULL;
     return rv;
 }
 
@@ -189,7 +190,7 @@ static Agrec_t *agmakeattrs(Agraph_t * context, void *obj)
     rec = agbindrec(obj, AgDataRecName, sizeof(Agattr_t), FALSE);
     datadict = agdictof(context, AGTYPE(obj));
     assert(datadict);
-    if (rec->dict == NIL(Dict_t *)) {
+    if (rec->dict == NULL) {
        rec->dict = agdictof(agroot(context), AGTYPE(obj));
        /* don't malloc(0) */
        sz = topdictsize(obj);
@@ -241,7 +242,7 @@ static void addattr(Agraph_t * g, Agobj_t * obj, Agsym_t * sym)
     Agattr_t *attr;
 
     attr = (Agattr_t *) agattrrec(obj);
-    assert(attr != NIL(Agattr_t *));
+    assert(attr != NULL);
     if (sym->id >= MINATTR)
        attr->str = (char **) AGDISC(g, mem)->resize(AGCLOS(g, mem),
                                                     attr->str,
@@ -321,7 +322,7 @@ static Agsym_t *getattr(Agraph_t * g, int kind, char *name)
 
 /*
  * create or update an existing attribute and return its descriptor.
- * if the new value is NIL(char*), this is only a search, no update.
+ * if the new value is NULL, this is only a search, no update.
  * when a new attribute is created, existing graphs/nodes/edges
  * receive its default value.
  */
@@ -434,7 +435,7 @@ char *agget(void *obj, char *name)
     char *rv;
 
     sym = agattrsym(obj, name);
-    if (sym == NILsym)
+    if (sym == NULL)
        rv = 0;                 /* note was "", but this provides more info */
     else {
        data = agattrrec((Agobj_t *) obj);
@@ -460,7 +461,7 @@ int agset(void *obj, char *name, char *value)
     int rv;
 
     sym = agattrsym(obj, name);
-    if (sym == NILsym)
+    if (sym == NULL)
        rv = FAILURE;
     else
        rv = agxset(obj, sym, value);
@@ -520,7 +521,7 @@ static void init_all_attrs(Agraph_t * g)
 
     root = agroot(g);
     agapply(root, (Agobj_t *) root, (agobjfn_t) agraphattr_init,
-           NIL(Agdisc_t *), TRUE);
+           NULL, TRUE);
     for (n = agfstnode(root); n; n = agnxtnode(root, n)) {
        agnodeattr_init(g, n);
        for (e = agfstout(root, n); e; e = agnxtout(root, e)) {
index bebcae8e597530838811f5db0d4de5a2fdc9e613..2dce5efaefbcc6cff31854317f7e2e0616797aa7 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include <cgraph/cghdr.h>
+#include <stddef.h>
 
 /*
  * provides "compound nodes" on top of base Libgraph.
@@ -92,7 +93,7 @@ static save_e_t stacktop(save_stack_t * stk)
     if (stk->stacksize > 0)
        rv = stk->mem[stk->stacksize - 1];
     else
-       rv.from = rv.to = NILnode;
+       rv.from = rv.to = NULL;
     return rv;
 }
 
@@ -159,7 +160,7 @@ int agsplice(Agedge_t * e, Agnode_t * target)
     Agsplice_arg_t splice_arg;
 
 
-    if ((e == NILedge) || (e->node == target))
+    if (e == NULL || e->node == target)
        return FAILURE;
     g = agraphof(e);
     t = AGTAIL(e);
@@ -180,7 +181,7 @@ Agnode_t *agcmpnode(Agraph_t * g, char *name)
     if (n && g && agassociate(n, subg))
        return n;
     else
-       return NILnode;
+       return NULL;
 }
 
 int agassociate(Agnode_t * n, Agraph_t * sub)
@@ -212,7 +213,7 @@ static void delete_outside_subg(Agraph_t * g, Agnode_t * node,
        dtdelete(g->n_dict, n);
 
        graphrec = agbindrec(g, Descriptor_id, sizeof(*graphrec), FALSE);
-       if ((d = graphrec->hidden_node_set) == NIL(Dict_t *)) {
+       if ((d = graphrec->hidden_node_set) == NULL) {
            /* use name disc. to permit search for hidden node by name */
            d = graphrec->hidden_node_set
                = agdtopen(g, &Ag_node_name_disc, Dttree);
@@ -240,7 +241,7 @@ int aghide(Agnode_t * cmpnode)
 
     g = agraphof(cmpnode);
     /* skip operation if node is not compound, or hidden */
-    if (agcmpgraph_of(cmpnode) == NILgraph)
+    if (agcmpgraph_of(cmpnode) == NULL)
        return FAILURE;
     noderec = (Agcmpnode_t *) aggetrec(cmpnode, Descriptor_id, FALSE);
 
@@ -287,8 +288,7 @@ static void insert_outside_subg(Agraph_t * g, Agnode_t * node,
     Agnode_t *n;
     Agcmpgraph_t *graphrec;
 
-    if ((g != subg)
-       && ((n = agsubnode(g, (Agnode_t *) node, FALSE)) == NILnode)) {
+    if (g != subg && (n = agsubnode(g, (Agnode_t *) node, FALSE)) == NULL) {
        graphrec = (Agcmpgraph_t *) aggetrec(g, Descriptor_id, FALSE);
        if (graphrec
            &&
@@ -316,7 +316,7 @@ int agexpose(Agnode_t * cmpnode)
 
     /* skip if this is not a collapsed subgraph */
     noderec = (Agcmpnode_t *) aggetrec(cmpnode, Descriptor_id, FALSE);
-    if ((noderec == NIL(Agcmpnode_t *) || NOT(noderec->collapsed)))
+    if (noderec == NULL || NOT(noderec->collapsed))
        return FAILURE;
 
     /* undo aghide (above) in reverse order.  first, expose subgraph */
@@ -358,7 +358,7 @@ Agraph_t *agcmpgraph_of(Agnode_t * n)
     if (noderec && NOT(noderec->collapsed))
        return noderec->subg;
     else
-       return NILgraph;
+       return NULL;
 }
 
 Agnode_t *agcmpnode_of(Agraph_t * g)
@@ -368,7 +368,7 @@ Agnode_t *agcmpnode_of(Agraph_t * g)
     if (graphrec)
        return graphrec->node;
     else
-       return NILnode;
+       return NULL;
 }
 
 Agnode_t *agfindhidden(Agraph_t * g, char *name)
@@ -381,5 +381,5 @@ Agnode_t *agfindhidden(Agraph_t * g, char *name)
        key.name = name;
        return (Agnode_t *) dtsearch(graphrec->hidden_node_set, &key);
     } else
-       return NILnode;
+       return NULL;
 }
index 13204db373a48a8c3ec6ad1a4d70197266dfb44d..133ba5d3ab1908deb4f6739f3cff4d6f6f9a78f4 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include <cgraph/cghdr.h>
+#include <stddef.h>
 
 #define IN_SET FALSE
 #define OUT_SET TRUE
@@ -25,7 +26,7 @@ static Agtag_t Tag;           /* to silence warnings about initialization */
 Agedge_t *agfstout(Agraph_t * g, Agnode_t * n)
 {
     Agsubnode_t *sn;
-    Agedge_t *e = NILedge;
+    Agedge_t *e = NULL;
 
     sn = agsubrep(g, n);
     if (sn) {
@@ -41,7 +42,7 @@ Agedge_t *agnxtout(Agraph_t * g, Agedge_t * e)
 {
     Agnode_t *n;
     Agsubnode_t *sn;
-    Agedge_t *f = NILedge;
+    Agedge_t *f = NULL;
 
     n = AGTAIL(e);
     sn = agsubrep(g, n);
@@ -56,7 +57,7 @@ Agedge_t *agnxtout(Agraph_t * g, Agedge_t * e)
 Agedge_t *agfstin(Agraph_t * g, Agnode_t * n)
 {
     Agsubnode_t *sn;
-    Agedge_t *e = NILedge;
+    Agedge_t *e = NULL;
 
     sn = agsubrep(g, n);
        if (sn) {
@@ -71,7 +72,7 @@ Agedge_t *agnxtin(Agraph_t * g, Agedge_t * e)
 {
     Agnode_t *n;
     Agsubnode_t *sn;
-    Agedge_t *f = NILedge;
+    Agedge_t *f = NULL;
 
     n = AGHEAD(e);
     sn = agsubrep(g, n);
@@ -87,7 +88,7 @@ Agedge_t *agfstedge(Agraph_t * g, Agnode_t * n)
 {
     Agedge_t *rv;
     rv = agfstout(g, n);
-    if (rv == NILedge)
+    if (rv == NULL)
        rv = agfstin(g, n);
     return rv;
 }
@@ -98,7 +99,7 @@ Agedge_t *agnxtedge(Agraph_t * g, Agedge_t * e, Agnode_t * n)
 
     if (AGTYPE(e) == AGOUTEDGE) {
        rv = agnxtout(g, e);
-       if (rv == NILedge) {
+       if (rv == NULL) {
            do {
                rv = !rv ? agfstin(g, n) : agnxtin(g,rv);
            } while (rv && (rv->node == n));
@@ -119,8 +120,8 @@ static Agedge_t *agfindedge_by_key(Agraph_t * g, Agnode_t * t, Agnode_t * h,
     Agedge_t *e, template;
     Agsubnode_t *sn;
 
-    if ((t == NILnode) || (h == NILnode))
-       return NILedge;
+    if (t == NULL || h == NULL)
+       return NULL;
     template.base.tag = key;
     template.node = t;         /* guess that fan-in < fan-out */
     sn = agsubrep(g, h);
@@ -264,9 +265,9 @@ Agedge_t *agidedge(Agraph_t * g, Agnode_t * t, Agnode_t * h,
     Agedge_t *e;
 
     e = agfindedge_by_id(g, t, h, id);
-    if ((e == NILedge) && agisundirected(g))
+    if (e == NULL && agisundirected(g))
        e = agfindedge_by_id(g, h, t, id);
-    if ((e == NILedge) && cflag && ok_to_make_edge(g, t, h)) {
+    if (e == NULL && cflag && ok_to_make_edge(g, t, h)) {
        root = agroot(g);
        if ((g != root) && ((e = agfindedge_by_id(root, t, h, id)))) {
            subedge(g, e);      /* old */
@@ -287,7 +288,7 @@ Agedge_t *agedge(Agraph_t * g, Agnode_t * t, Agnode_t * h, char *name,
     int have_id;
 
     have_id = agmapnametoid(g, AGEDGE, name, &my_id, FALSE);
-    if (have_id || ((name == NILstr) && (NOT(cflag) || agisstrict(g)))) {
+    if (have_id || (name == NULL && (NOT(cflag) || agisstrict(g)))) {
        /* probe for pre-existing edge */
        Agtag_t key;
        key = Tag;
@@ -300,13 +301,13 @@ Agedge_t *agedge(Agraph_t * g, Agnode_t * t, Agnode_t * h, char *name,
 
        /* might already exist locally */
        e = agfindedge_by_key(g, t, h, key);
-       if ((e == NILedge) && agisundirected(g))
+       if (e == NULL && agisundirected(g))
            e = agfindedge_by_key(g, h, t, key);
        if (e)
            return e;
        if (cflag) {
            e = agfindedge_by_key(agroot(g), t, h, key);
-           if ((e == NILedge) && agisundirected(g))
+           if (e == NULL && agisundirected(g))
                e = agfindedge_by_key(agroot(g), h, t, key);
            if (e) {
                subedge(g,e);
@@ -321,7 +322,7 @@ Agedge_t *agedge(Agraph_t * g, Agnode_t * t, Agnode_t * h, char *name,
        agregister(g, AGEDGE, e); /* register new object in external namespace */
     }
     else
-       e = NILedge;
+       e = NULL;
     return e;
 }
 
@@ -358,7 +359,7 @@ void agdeledgeimage(Agraph_t * g, Agedge_t * e, void *ignored)
 int agdeledge(Agraph_t * g, Agedge_t * e)
 {
     e = AGMKOUT(e);
-    if (agfindedge_by_key(g, agtail(e), aghead(e), AGTAG(e)) == NILedge)
+    if (agfindedge_by_key(g, agtail(e), aghead(e), AGTAG(e)) == NULL)
        return FAILURE;
 
     if (g == agroot(g)) {
@@ -368,7 +369,7 @@ int agdeledge(Agraph_t * g, Agedge_t * e)
        agrecclose((Agobj_t *) e);
        agfreeid(g, AGEDGE, AGID(e));
     }
-    if (agapply (g, (Agobj_t *) e, (agobjfn_t) agdeledgeimage, NILedge, FALSE) == SUCCESS) {
+    if (agapply (g, (Agobj_t *) e, (agobjfn_t) agdeledgeimage, NULL, FALSE) == SUCCESS) {
        if (g == agroot(g))
                agfree(g, e);
        return SUCCESS;
@@ -381,12 +382,12 @@ Agedge_t *agsubedge(Agraph_t * g, Agedge_t * e, int cflag)
     Agnode_t *t, *h;
     Agedge_t *rv;
 
-    rv = NILedge;
+    rv = NULL;
     t = agsubnode(g, AGTAIL(e), cflag);
     h = agsubnode(g, AGHEAD(e), cflag);
     if (t && h) {
        rv = agfindedge_by_key(g, t, h, AGTAG(e));
-       if (cflag && (rv == NILedge)) {
+       if (cflag && rv == NULL) {
        installedge(g, e);
        rv = e;
        }
@@ -548,6 +549,6 @@ static Agedge_t *agfindedge_by_name(Agraph_t * g, Agnode_t * t,
     if (agmapnametoid(agraphof(t), AGEDGE, name, &id, FALSE))
        return agfindedge_by_id(g, t, h, id);
     else
-       return NILedge;
+       return NULL;
 }
 #endif
index db906d458992319f07a63d47d2e62fdd50805e4b..3c2ca489286d88f5435f55472211fb8d37ad3cd9 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <stdio.h>  /* SAFE */
 #include <cghdr.h>     /* SAFE */
+#include <stddef.h>
 extern void aagerror(char *);
 
 #ifdef _WIN32
@@ -105,7 +106,7 @@ static gstack_t *S;
 %%
 
 graph          :  hdr body {freestack(); endgraph();}
-                       |  error        {if (G) {freestack(); endgraph(); agclose(G); G = Ag_G_global = NIL(Agraph_t*);}}
+                       |  error        {if (G) {freestack(); endgraph(); agclose(G); G = Ag_G_global = NULL;}}
                        |  /* empty */
                        ;
 
@@ -143,13 +144,13 @@ rcompound :       T_edgeop {getedgeitems(1);} simple {getedgeitems(2);} rcompound {$$
 
 nodelist       : node | nodelist ',' node ;
 
-node           : atom {appendnode($1,NIL(char*),NIL(char*));}
-            | atom ':' atom {appendnode($1,$3,NIL(char*));}
+node           : atom {appendnode($1,NULL,NULL);}
+            | atom ':' atom {appendnode($1,$3,NULL);}
             | atom ':' atom ':' atom {appendnode($1,$3,$5);}
             ;
 
 attrstmt       :  attrtype optmacroname attrlist {attrstmt($1,$2);}
-                       |  graphattrdefs {attrstmt(T_graph,NIL(char*));}
+                       |  graphattrdefs {attrstmt(T_graph,NULL);}
                        ;
 
 attrtype :     T_graph {$$ = T_graph;}
@@ -158,7 +159,7 @@ attrtype :  T_graph {$$ = T_graph;}
                        ;
 
 optmacroname : atom '=' {$$ = $1;}
-                       | /* empty */ {$$ = NIL(char*); }
+                       | /* empty */ {$$ = NULL; }
                        ;
 
 optattr                :       attrlist |  /* empty */ ;
@@ -176,7 +177,7 @@ attritem    : attrassignment | attrmacro ;
 attrassignment :  atom '=' atom {appendattr($1,$3);}
                        ;
 
-attrmacro      :       '@' atom {appendattr($2,NIL(char*));}   /* not yet impl */
+attrmacro      :       '@' atom {appendattr($2,NULL);} /* not yet impl */
                        ;
 
 graphattrdefs : attrassignment
@@ -186,8 +187,8 @@ subgraph    :  optsubghdr {opensubg($1);} body {closesubg();}
                        ;
 
 optsubghdr     : T_subgraph atom {$$=$2;}
-                       | T_subgraph  {$$=NIL(char*);}
-                       | /* empty */ {$$=NIL(char*);}
+                       | T_subgraph  {$$=NULL;}
+                       | /* empty */ {$$=NULL;}
                        ;
 
 optseparator :  ';' | ',' | /*empty*/ ;
@@ -201,9 +202,6 @@ qatom       :  T_qatom {$$ = $1;}
                        ;
 %%
 
-#define NILitem  NIL(item*)
-
-
 static item *newitem(int tag, void *p0, char *p1)
 {
        item    *rv = agalloc(G,sizeof(item));
@@ -218,10 +216,10 @@ static item *cons_attr(char *name, char *value)
        { return newitem(T_atom,name,value); }
 
 static item *cons_list(item *list)
-       { return newitem(T_list,list,NIL(char*)); }
+       { return newitem(T_list,list,NULL); }
 
 static item *cons_subg(Agraph_t *subg)
-       { return newitem(T_subgraph,subg,NIL(char*)); }
+       { return newitem(T_subgraph,subg,NULL); }
 
 static gstack_t *push(gstack_t *s, Agraph_t *subg) {
        gstack_t *rv;
@@ -241,7 +239,7 @@ static gstack_t *pop(gstack_t *s)
 
 #ifdef NOTDEF
 static item *cons_edge(Agedge_t *e)
-       { return newitem(T_edge,e,NIL(char*)); }
+       { return newitem(T_edge,e,NULL); }
 #endif
 
 static void delete_items(item *ilist)
@@ -261,14 +259,14 @@ static void delete_items(item *ilist)
 #ifdef NOTDEF
 static void initlist(list_t *list)
 {
-       list->first = list->last = NILitem;
+       list->first = list->last = NULL;
 }
 #endif
 
 static void deletelist(list_t *list)
 {
        delete_items(list->first);
-       list->first = list->last = NILitem;
+       list->first = list->last = NULL;
 }
 
 #ifdef NOTDEF
@@ -276,7 +274,7 @@ static void listins(list_t *list, item *v)
 {
        v->next = list->first;
        list->first = v;
-       if (list->last == NILitem) list->last = v;
+       if (list->last == NULL) list->last = v;
 }
 #endif
 
@@ -284,7 +282,7 @@ static void listapp(list_t *list, item *v)
 {
        if (list->last) list->last->next = v;
        list->last = v;
-       if (list->first == NILitem) list->first = v;
+       if (list->first == NULL) list->first = v;
 }
 
 
@@ -293,7 +291,7 @@ static void appendattr(char *name, char *value)
 {
        item            *v;
 
-       assert(value != NIL(char*));
+       assert(value != NULL);
        v = cons_attr(name,value);
        listapp(&(S->attrlist),v);
 }
@@ -307,7 +305,7 @@ static void bindattrs(int kind)
                assert(aptr->tag == T_atom);    /* signifies unbound attr */
                name = aptr->u.name;
                if ((kind == AGEDGE) && streq(name,Key)) continue;
-               if ((aptr->u.asym = agattr(S->g,kind,name,NIL(char*))) == NILsym)
+               if ((aptr->u.asym = agattr(S->g,kind,name,NULL)) == NULL)
                        aptr->u.asym = agattr(S->g,kind,name,"");
                aptr->tag = T_attr;                             /* signifies bound attr */
                agstrfree(G,name);
@@ -353,7 +351,7 @@ static void attrstmt(int tkind, char *macroname)
        if (macroname) nomacros();
                /* invoking a macro def */
        for (aptr = S->attrlist.first; aptr; aptr = aptr->next)
-               if (aptr->str == NIL(char*)) nomacros();
+               if (aptr->str == NULL) nomacros();
 
        switch(tkind) {
                case T_graph: kind = AGRAPH; break;
@@ -414,7 +412,7 @@ static void getedgeitems(int x)
 
        if (S->nodelist.first) {
                v = cons_list(S->nodelist.first);
-               S->nodelist.first = S->nodelist.last = NILitem;
+               S->nodelist.first = S->nodelist.last = NULL;
        }
        else {if (S->subg) v = cons_subg(S->subg); S->subg = 0;}
        /* else nil append */
@@ -432,7 +430,7 @@ static void endedge(void)
        bindattrs(AGEDGE);
 
        /* look for "key" pseudo-attribute */
-       key = NIL(char*);
+       key = NULL;
        for (aptr = S->attrlist.first; aptr; aptr = aptr->next) {
                if ((aptr->tag == T_atom) && streq(aptr->u.name,Key))
                        key = aptr->str;
@@ -443,7 +441,7 @@ static void endedge(void)
                if (p->tag == T_subgraph) {
                        subg = p->u.subg;
                        for (t = agfstnode(subg); t; t = agnxtnode(subg,t))
-                               edgerhs(agsubnode(S->g,t,FALSE),NIL(char*),p->next,key);
+                               edgerhs(agsubnode(S->g,t,FALSE),NULL,p->next,key);
                }
                else {
                        for (tptr = p->u.list; tptr; tptr = tptr->next)
@@ -507,7 +505,7 @@ static void edgerhs(Agnode_t *tail, char *tport, item *hlist, char *key)
        if (hlist->tag == T_subgraph) {
                subg = hlist->u.subg;
                for (head = agfstnode(subg); head; head = agnxtnode(subg,head))
-                       newedge(tail,tport,agsubnode(S->g,head,FALSE),NIL(char*),key);
+                       newedge(tail,tport,agsubnode(S->g,head,FALSE),NULL,key);
        }
        else {
                for (hptr = hlist->u.list; hptr; hptr = hptr->next)
@@ -519,7 +517,7 @@ static void mkport(Agedge_t *e, char *name, char *val)
 {
        Agsym_t *attr;
        if (val) {
-               if ((attr = agattr(S->g,AGEDGE,name,NIL(char*))) == NILsym)
+               if ((attr = agattr(S->g,AGEDGE,name,NULL)) == NULL)
                        attr = agattr(S->g,AGEDGE,name,"");
                agxset(e,attr,val);
        }
@@ -551,7 +549,7 @@ static void startgraph(char *name, int directed, int strict)
 {
        static Agdesc_t req;    /* get rid of warnings */
 
-       if (G == NILgraph) {
+       if (G == NULL) {
                SubgraphDepth = 0;
                req.directed = directed;
                req.strict = strict;
@@ -562,7 +560,7 @@ static void startgraph(char *name, int directed, int strict)
                Ag_G_global = G;
        }
        S = push(S,G);
-       agstrfree(NIL(Agraph_t*),name);
+       agstrfree(NULL,name);
 }
 
 static void endgraph()
@@ -604,13 +602,13 @@ Agraph_t *agconcat(Agraph_t *g, void *chan, Agdisc_t *disc)
 {
        aagin = chan;
        G = g;
-       Ag_G_global = NILgraph;
+       Ag_G_global = NULL;
        Disc = (disc? disc :  &AgDefaultDisc);
        aglexinit(Disc, chan);
        aagparse();
-       if (Ag_G_global == NILgraph) aglexbad();
+       if (Ag_G_global == NULL) aglexbad();
        return Ag_G_global;
 }
 
-Agraph_t *agread(void *fp, Agdisc_t *disc) {return agconcat(NILgraph,fp,disc); }
+Agraph_t *agread(void *fp, Agdisc_t *disc) {return agconcat(NULL,fp,disc); }
 
index d695c6949bf45290501b48673eab8b5d8194d502..c3d6980311fb293da15a3a939b5c353dc4c0cde6 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include <cgraph/cghdr.h>
+#include <stddef.h>
 
 Agraph_t *Ag_G_global;
 
@@ -97,7 +98,7 @@ int agclose(Agraph_t * g)
     Agnode_t *n, *next_n;
 
     par = agparent(g);
-    if (par == NILgraph && AGDISC(g, mem)->close) {
+    if (par == NULL && AGDISC(g, mem)->close) {
        /* free entire heap */
        agmethod_delete(g, g);  /* invoke user callbacks */
        agfreeid(g, AGRAPH, AGID(g));
index 58682a25230dd7426c4708539abbc0948372b8a7..f5e325a13a8fb3481d79efe66d4b4e2f0814074c 100644 (file)
@@ -14,6 +14,7 @@
 #include <stdio.h>
 #include <cgraph/cghdr.h>
 #include <inttypes.h>
+#include <stddef.h>
 
 /* a default ID allocator that works off the shared string lib */
 
@@ -117,7 +118,7 @@ int agmapnametoid(Agraph_t * g, int objtype, char *str,
 
     if (createflag) {
        /* get a new anonymous ID, and store in the internal map */
-       rv = (int) AGDISC(g, id)->map(AGCLOS(g, id), objtype, NILstr, result,
+       rv = (int) AGDISC(g, id)->map(AGCLOS(g, id), objtype, NULL, result,
                                createflag);
        if (rv && str)
            aginternalmapinsert(g, objtype, str, *result);
index 6ba271c65b498d9d96dc9c5f9d12c725fa6d3fc0..b56df0c34972e521ce3752a2162436feb387c851 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include <cgraph/cghdr.h>
+#include <stddef.h>
 
 typedef struct IMapEntry_s {
     Dtlink_t namedict_link;
@@ -72,24 +73,24 @@ static Dtdisc_t LookupByName = {
     0,                         /* object ptr is passed as key */
     0,                         /* size (ignored) */
     offsetof(IMapEntry_t, namedict_link),
-    NIL(Dtmake_f),
-    NIL(Dtfree_f),
+    NULL,
+    NULL,
     namecmpf,
-    NIL(Dthash_f),
+    NULL,
     agdictobjmem,
-    NIL(Dtevent_f)
+    NULL
 };
 
 static Dtdisc_t LookupById = {
     0,                         /* object ptr is passed as key */
     0,                         /* size (ignored) */
     offsetof(IMapEntry_t, iddict_link),
-    NIL(Dtmake_f),
-    NIL(Dtfree_f),
+    NULL,
+    NULL,
     idcmpf,
-    NIL(Dthash_f),
+    NULL,
     agdictobjmem,
-    NIL(Dtevent_f)
+    NULL
 };
 
 int aginternalmaplookup(Agraph_t * g, int objtype, char *str,
@@ -127,10 +128,10 @@ void aginternalmapinsert(Agraph_t * g, int objtype, char *str,
 
     if (objtype == AGINEDGE)
        objtype = AGEDGE;
-    if ((d_name_to_id = g->clos->lookup_by_name[objtype]) == NIL(Dict_t *))
+    if ((d_name_to_id = g->clos->lookup_by_name[objtype]) == NULL)
        d_name_to_id = g->clos->lookup_by_name[objtype] =
            agdtopen(g, &LookupByName, Dttree);
-    if ((d_id_to_name = g->clos->lookup_by_id[objtype]) == NIL(Dict_t *))
+    if ((d_id_to_name = g->clos->lookup_by_id[objtype]) == NULL)
        d_id_to_name = g->clos->lookup_by_id[objtype] =
            agdtopen(g, &LookupById, Dttree);
     dtinsert(d_name_to_id, ent);
@@ -148,7 +149,7 @@ static IMapEntry_t *find_isym(Agraph_t * g, int objtype, IDTYPE id)
        itemplate.id = id;
        isym = (IMapEntry_t *) dtsearch(d, &itemplate);
     } else
-       isym = NIL(IMapEntry_t *);
+       isym = NULL;
     return isym;
 }
 
@@ -158,7 +159,7 @@ char *aginternalmapprint(Agraph_t * g, int objtype, IDTYPE id)
 
     if ((isym = find_isym(g, objtype, id)))
        return isym->str;
-    return NILstr;
+    return NULL;
 }
 
 
@@ -206,7 +207,7 @@ static void closeit(Dict_t ** d)
     for (i = 0; i < 3; i++) {
        if (d[i]) {
            dtclose(d[i]);
-           d[i] = NIL(Dict_t *);
+           d[i] = NULL;
        }
     }
 }
index 765bb5832b58478d45771f8366537cad53de943c..5e3554a4477494e195392a77b0f2c2e9a25a8cb4 100644 (file)
  *************************************************************************/
 
 #include <cgraph/cghdr.h>
+#include <stddef.h>
 
 /* memory management discipline and entry points */
 static void *memopen(Agdisc_t* disc)
 {
-    return NIL(void *);
+    return NULL;
 }
 
 static void *memalloc(void *heap, size_t request)
@@ -64,7 +65,7 @@ void *agalloc(Agraph_t * g, size_t size)
     void *mem;
 
     mem = AGDISC(g, mem)->alloc(AGCLOS(g, mem), size);
-    if (mem == NIL(void *))
+    if (mem == NULL)
         agerr(AGERR,"memory allocation failure");
     return mem;
 }
@@ -79,10 +80,10 @@ void *agrealloc(Agraph_t * g, void *ptr, size_t oldsize, size_t size)
        else
            mem =
                AGDISC(g, mem)->resize(AGCLOS(g, mem), ptr, oldsize, size);
-       if (mem == NIL(void *))
+       if (mem == NULL)
             agerr(AGERR,"memory re-allocation failure");
     } else
-       mem = NIL(void *);
+       mem = NULL;
     return mem;
 }
 
index a6e552cec8485f5a80a4951fac0251f7e448da96..2edf007b2a52837c42cf5d25205cbbb7c2f5eca9 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include <cgraph/cghdr.h>
+#include <stddef.h>
 
 Agnode_t *agfindnode_by_id(Agraph_t * g, IDTYPE id)
 {
@@ -22,7 +23,7 @@ Agnode_t *agfindnode_by_id(Agraph_t * g, IDTYPE id)
     dummy.base.tag.id = id;
     template.node = &dummy;
     sn = (Agsubnode_t *) dtsearch(g->n_id, &template);
-    return sn ? sn->node : NILnode;
+    return sn ? sn->node : NULL;
 }
 
 static Agnode_t *agfindnode_by_name(Agraph_t * g, char *name)
@@ -32,14 +33,14 @@ static Agnode_t *agfindnode_by_name(Agraph_t * g, char *name)
     if (agmapnametoid(g, AGNODE, name, &id, FALSE))
        return agfindnode_by_id(g, id);
     else
-       return NILnode;
+       return NULL;
 }
 
 Agnode_t *agfstnode(Agraph_t * g)
 {
     Agsubnode_t *sn;
     sn = (Agsubnode_t *) dtfirst(g->n_seq);
-    return sn ? sn->node : NILnode;
+    return sn ? sn->node : NULL;
 }
 
 Agnode_t *agnxtnode(Agraph_t * g, Agnode_t * n)
@@ -47,14 +48,14 @@ Agnode_t *agnxtnode(Agraph_t * g, Agnode_t * n)
     Agsubnode_t *sn;
     sn = agsubrep(g, n);
     if (sn) sn = ((Agsubnode_t *) dtnext(g->n_seq, sn));
-    return sn ? sn->node : NILnode;
+    return sn ? sn->node : NULL;
 }
 
 Agnode_t *aglstnode(Agraph_t * g)
 {
     Agsubnode_t *sn;
     sn = (Agsubnode_t *) dtlast(g->n_seq);
-    return sn ? sn->node : NILnode;
+    return sn ? sn->node : NULL;
 }
 
 Agnode_t *agprvnode(Agraph_t * g, Agnode_t * n)
@@ -62,7 +63,7 @@ Agnode_t *agprvnode(Agraph_t * g, Agnode_t * n)
     Agsubnode_t *sn;
     sn = agsubrep(g, n);
     if (sn) sn = ((Agsubnode_t *) dtprev(g->n_seq, sn));
-    return sn ? sn->node : NILnode;
+    return sn ? sn->node : NULL;
 }
 
 
@@ -123,7 +124,7 @@ Agnode_t *agidnode(Agraph_t * g, IDTYPE id, int cflag)
     Agnode_t *n;
 
     n = agfindnode_by_id(g, id);
-    if ((n == NILnode) && cflag) {
+    if (n == NULL && cflag) {
        root = agroot(g);
        if ((g != root) && ((n = agfindnode_by_id(root, id))))  /*old */
            agsubnode(g, n, TRUE);      /* insert locally */
@@ -133,7 +134,7 @@ Agnode_t *agidnode(Agraph_t * g, IDTYPE id, int cflag)
                installnodetoroot(g, n);
                initnode(g, n);
            } else
-               n = NILnode;    /* allocid for new node failed */
+               n = NULL;       /* allocid for new node failed */
        }
     }
     /* else return probe result */
@@ -167,7 +168,7 @@ Agnode_t *agnode(Agraph_t * g, char *name, int cflag)
        return n;
     }
 
-    return NILnode;
+    return NULL;
 }
 
 /* removes image of node and its edges from graph.
@@ -207,7 +208,7 @@ int agdelnode(Agraph_t * g, Agnode_t * n)
        agrecclose((Agobj_t *) n);
        agfreeid(g, AGNODE, AGID(n));
     }
-    if (agapply (g, (Agobj_t *) n, (agobjfn_t) agdelnodeimage, NILnode, FALSE) == SUCCESS) {
+    if (agapply (g, (Agobj_t *) n, (agobjfn_t) agdelnodeimage, NULL, FALSE) == SUCCESS) {
        if (g == agroot(g))
            agfree(g, n);
        return SUCCESS;
@@ -238,7 +239,7 @@ int agrelabel_node(Agnode_t * n, char *newname)
     if (agfindnode_by_name(g, newname))
        return FAILURE;
     if (agmapnametoid(g, AGNODE, newname, &new_id, TRUE)) {
-       if (agfindnode_by_id(agroot(g), new_id) == NILnode) {
+       if (agfindnode_by_id(agroot(g), new_id) == NULL) {
            agfreeid(g, AGNODE, AGID(n));
            agapply(g, (Agobj_t *) n, (agobjfn_t) dict_relabel,
                    (void *) &new_id, FALSE);
@@ -258,9 +259,9 @@ Agnode_t *agsubnode(Agraph_t * g, Agnode_t * n0, int cflag)
     Agnode_t *n;
 
     if (agroot(g) != n0->root)
-       return NILnode;
+       return NULL;
     n = agfindnode_by_id(g, AGID(n0));
-    if ((n == NILnode) && cflag) {
+    if (n == NULL && cflag) {
        if ((par = agparent(g))) {
            n = agsubnode(par, n0, cflag);
            installnode(g, n);
index b810d0cb907135e251465563dcd3bcd4687818b9..358ed623a439c567ca8ada246e3e225e9ab01ad1 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include <cgraph/cghdr.h>
+#include <stddef.h>
 
 int agdelete(Agraph_t * g, void *obj)
 {
@@ -78,17 +79,17 @@ void agmethod_init(Agraph_t * g, void *obj)
     if (g->clos->callbacks_enabled)
        aginitcb(g, obj, g->clos->cb);
     else
-       agrecord_callback(g, obj, CB_INITIALIZE, NILsym);
+       agrecord_callback(g, obj, CB_INITIALIZE, NULL);
 }
 
 void aginitcb(Agraph_t * g, void *obj, Agcbstack_t * cbstack)
 {
     agobjfn_t fn;
 
-    if (cbstack == NIL(Agcbstack_t *))
+    if (cbstack == NULL)
        return;
     aginitcb(g, obj, cbstack->prev);
-    fn = NIL(agobjfn_t);
+    fn = NULL;
     switch (AGTYPE(obj)) {
     case AGRAPH:
        fn = cbstack->f->graph.ins;
@@ -116,10 +117,10 @@ void agupdcb(Agraph_t * g, void *obj, Agsym_t * sym, Agcbstack_t * cbstack)
 {
     agobjupdfn_t fn;
 
-    if (cbstack == NIL(Agcbstack_t *))
+    if (cbstack == NULL)
        return;
     agupdcb(g, obj, sym, cbstack->prev);
-    fn = NIL(agobjupdfn_t);
+    fn = NULL;
     switch (AGTYPE(obj)) {
     case AGRAPH:
        fn = cbstack->f->graph.mod;
@@ -140,17 +141,17 @@ void agmethod_delete(Agraph_t * g, void *obj)
     if (g->clos->callbacks_enabled)
        agdelcb(g, obj, g->clos->cb);
     else
-       agrecord_callback(g, obj, CB_DELETION, NILsym);
+       agrecord_callback(g, obj, CB_DELETION, NULL);
 }
 
 void agdelcb(Agraph_t * g, void *obj, Agcbstack_t * cbstack)
 {
     agobjfn_t fn;
 
-    if (cbstack == NIL(Agcbstack_t *))
+    if (cbstack == NULL)
        return;
     agdelcb(g, obj, cbstack->prev);
-    fn = NIL(agobjfn_t);
+    fn = NULL;
     switch (AGTYPE(obj)) {
     case AGRAPH:
        fn = cbstack->f->graph.del;
@@ -169,7 +170,7 @@ void agdelcb(Agraph_t * g, void *obj, Agcbstack_t * cbstack)
 Agraph_t *agroot(void* obj)
 {
     // fixes CVE-2019-11023 by moving the problem to the caller :-)
-    if (obj == 0) return NILgraph; 
+    if (obj == 0) return NULL;
     switch (AGTYPE(obj)) {
     case AGINEDGE:
     case AGOUTEDGE:
@@ -180,7 +181,7 @@ Agraph_t *agroot(void* obj)
        return ((Agraph_t *) obj)->root;
     default:                   /* actually can't occur if only 2 bit tags */
        agerr(AGERR, "agroot of a bad object");
-       return NILgraph;
+       return NULL;
     }
 }
 
@@ -196,7 +197,7 @@ Agraph_t *agraphof(void *obj)
        return (Agraph_t *) obj;
     default:                   /* actually can't occur if only 2 bit tags */
        agerr(AGERR, "agraphof a bad object");
-       return NILgraph;
+       return NULL;
     }
 }
 
index cb8c311b901769ccd25b6b1920ad921d4ad7731b..074d644a96de7b326800ce70478617de0296fb2c 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include <cgraph/cghdr.h>
+#include <stddef.h>
 
 static char DRName[] = "_AG_pending";
 
@@ -61,15 +62,15 @@ static Dtdisc_t Disc = {
     offsetof(pending_cb_t, key),       /* sort by 'key' */
     sizeof(uint64_t),
     0,                         /* link offset */
-    NIL(Dtmake_f),
+    NULL,
     freef,
-    NIL(Dtcompar_f),
-    NIL(Dthash_f)
+    NULL,
+    NULL
 };
 
 static Dict_t *dictof(pendingset_t * ds, Agobj_t * obj, int kind)
 {
-    Dict_t **dict_ref = NIL(Dict_t **);
+    Dict_t **dict_ref = NULL;
 
     dict_ref = 0;
     switch (AGTYPE(obj)) {
@@ -124,7 +125,7 @@ static Dict_t *dictof(pendingset_t * ds, Agobj_t * obj, int kind)
 
     if (dict_ref == 0)
        agerr(AGERR, "pend dictof a bad object");
-    if (*dict_ref == NIL(Dict_t *))
+    if (*dict_ref == NULL)
        *dict_ref = agdtopen(agraphof(obj), &Disc, Dttree);
     return *dict_ref;
 }
@@ -148,11 +149,11 @@ static void record_sym(Agobj_t * obj, pending_cb_t * handle,
 {
     symlist_t *sym, *nsym, *psym;
 
-    psym = NIL(symlist_t *);
+    psym = NULL;
     for (sym = handle->symlist; sym; psym = sym, sym = sym->link) {
        if (sym->sym == optsym)
            break;
-       if (sym == NIL(symlist_t *)) {
+       if (sym == NULL) {
            nsym = agalloc(agraphof(obj), sizeof(symlist_t));
            nsym->sym = optsym;
            if (psym)
index 61a3411f0ce18eeb7108e0b9e76a1ea8c7bc0f3a..80d8073bc7e0a1637267a422aa83262785e9f307 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <cgraph/cghdr.h>
+#include       <stddef.h>
 
 /*
  * run time records
@@ -43,7 +44,7 @@ Agrec_t *aggetrec(void *obj, char *name, int mtf)
            break;
        d = d->next;
        if (d == first) {
-           d = NIL(Agrec_t *);
+           d = NULL;
            break;
        }
     }
@@ -67,7 +68,7 @@ static void objputrec(Agraph_t * g, Agobj_t * obj, void *arg)
     NOTUSED(g);
     newrec = arg;
     firstrec = obj->data;
-    if (firstrec == NIL(Agrec_t *))
+    if (firstrec == NULL)
        newrec->next = newrec;  /* 0 elts */
     else {
        if (firstrec->next == firstrec) {
@@ -94,7 +95,7 @@ void *agbindrec(void *arg_obj, char *recname, unsigned int recsize,
     obj = arg_obj;
     g = agraphof(obj);
     rec = aggetrec(obj, recname, FALSE);
-    if (rec == NIL(Agrec_t *) && recsize > 0) {
+    if (rec == NULL && recsize > 0) {
        rec = agalloc(g, recsize);
        rec->name = agstrdup(g, recname);
        objputrec(g, obj, rec);
@@ -112,7 +113,7 @@ static void objdelrec(Agraph_t * g, Agobj_t * obj, void *arg_rec)
     Agrec_t *rec = (Agrec_t *) arg_rec, *newrec;
     if (obj->data == rec) {
        if (rec->next == rec)
-           newrec = NIL(Agrec_t *);
+           newrec = NULL;
        else
            newrec = rec->next;
        set_data(obj, newrec, FALSE);
@@ -249,5 +250,5 @@ void agrecclose(Agobj_t * obj)
            rec = nrec;
        } while (rec != obj->data);
     }
-    obj->data = NIL(Agrec_t *);
+    obj->data = NULL;
 }
index 9bee8dcdab3b62e3c7a97d3ddb8ff91ea28763ca..7a3a9bc60b4903055dbbc189f110870b432308a5 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include <cgraph/cghdr.h>
+#include <stddef.h>
 
 /*
  * reference counted strings.
@@ -31,12 +32,12 @@ static Dtdisc_t Refstrdisc = {
     offsetof(refstr_t, s),     /* key */
     -1,                                /* size */
     0,                         /* link offset */
-    NIL(Dtmake_f),
+    NULL,
     agdictobjfree,
-    NIL(Dtcompar_f),
-    NIL(Dthash_f),
+    NULL,
+    NULL,
     agdictobjmem,
-    NIL(Dtevent_f)
+    NULL
 };
 
 static Dict_t *Refdict_default;
@@ -54,7 +55,7 @@ static Dict_t *refdict(Agraph_t * g)
        dictref = &(g->clos->strdict);
     else
        dictref = &Refdict_default;
-    if (*dictref == NIL(Dict_t *)) {
+    if (*dictref == NULL) {
        *dictref = agdtopen(g, &Refstrdisc, Dttree);
        HTML_BIT = ((unsigned int) 1) << (sizeof(unsigned int) * 8 - 1);
        CNT_BITS = ~HTML_BIT;
@@ -82,7 +83,7 @@ static char *refstrbind(Dict_t * strdict, char *s)
     if (r)
        return r->s;
     else
-       return NIL(char *);
+       return NULL;
 }
 
 char *agstrbind(Agraph_t * g, char *s)
@@ -96,8 +97,8 @@ char *agstrdup(Agraph_t * g, char *s)
     Dict_t *strdict;
     size_t sz;
 
-    if (s == NIL(char *))
-        return NIL(char *);
+    if (s == NULL)
+        return NULL;
     strdict = refdict(g);
     r = refsymbind(strdict, s);
     if (r)
@@ -122,8 +123,8 @@ char *agstrdup_html(Agraph_t * g, char *s)
     Dict_t *strdict;
     size_t sz;
 
-    if (s == NIL(char *))
-        return NIL(char *);
+    if (s == NULL)
+        return NULL;
     strdict = refdict(g);
     r = refsymbind(strdict, s);
     if (r)
@@ -147,7 +148,7 @@ int agstrfree(Agraph_t * g, char *s)
     refstr_t *r;
     Dict_t *strdict;
 
-    if (s == NIL(char *))
+    if (s == NULL)
         return FAILURE;
 
     strdict = refdict(g);
@@ -162,7 +163,7 @@ int agstrfree(Agraph_t * g, char *s)
             */
        }
     }
-    if (r == NIL(refstr_t *))
+    if (r == NULL)
        return FAILURE;
     return SUCCESS;
 }
index 6e06994a2b35b1fc1fa43f1ef729c299e4a4cde2..a09938fc84c94e77373f4c1f35b9258f60cd7bea 100644 (file)
@@ -30,6 +30,7 @@
 #include <cghdr.h>
 #include <agxbuf.h>
 #include <ctype.h>
+#include <stddef.h>
 // #define YY_BUF_SIZE 128000
 #define GRAPH_EOF_TOKEN                '@'             /* lex class must be defined below */
        /* this is a workaround for linux flex */
@@ -70,7 +71,7 @@ int gv_isatty_suppression;
 /* buffer for arbitrary length strings (longer than BUFSIZ) */
 static char    *Sbuf,*Sptr,*Send;
 static void beginstr(void) {
-       if (Sbuf == NIL(char*)) {
+       if (Sbuf == NULL) {
                Sbuf = malloc(BUFSIZ);
                Send = Sbuf + BUFSIZ;
        }
index 3fb06bde80cab53b3506b326a419fcb987a85242..979b26999c2147f4e1400dfd9eb557be92ab576b 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include <cgraph/cghdr.h>
+#include <stddef.h>
 
 static Agraph_t *agfindsubg_by_id(Agraph_t * g, IDTYPE id)
 {
@@ -44,7 +45,7 @@ Agraph_t *agidsubg(Agraph_t * g, IDTYPE id, int cflag)
 {
     Agraph_t *subg;
     subg = agfindsubg_by_id(g, id);
-    if ((subg == NILgraph) && cflag && agallocid(g, AGRAPH, id))
+    if (subg == NULL && cflag && agallocid(g, AGRAPH, id))
        subg = localsubg(g, id);
     return subg;
 }
@@ -66,7 +67,7 @@ Agraph_t *agsubg(Agraph_t * g, char *name, int cflag)
        return subg;
     }
 
-    return NILgraph;
+    return NULL;
 }
 
 Agraph_t *agfstsubg(Agraph_t * g)
index 1b7b017b3be8ca8599749b57adb23f4f005bd156..e06f11f4f0304a641c0a757ba4cd983646c36061 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include <cgraph/cghdr.h>
+#include <stddef.h>
 
 static Agraph_t *Ag_dictop_G;
 
@@ -34,7 +35,7 @@ void *agdictobjmem(Dict_t * dict, void * p, size_t size, Dtdisc_t * disc)
        else
            return malloc(size);
     }
-    return NIL(void *);
+    return NULL;
 }
 
 void agdictobjfree(Dict_t * dict, void * p, Dtdisc_t * disc)
@@ -60,7 +61,7 @@ Dict_t *agdtopen(Agraph_t * g, Dtdisc_t * disc, Dtmethod_t * method)
     Ag_dictop_G = g;
     d = dtopen(disc, method);
     disc->memoryf = memf;
-    Ag_dictop_G = NIL(Agraph_t*);
+    Ag_dictop_G = NULL;
     return d;
 }
 
@@ -75,20 +76,20 @@ int agdtclose(Agraph_t * g, Dict_t * dict)
     Dtmemory_f memf;
     Dtdisc_t *disc;
 
-    disc = dtdisc(dict, NIL(Dtdisc_t *), 0);
+    disc = dtdisc(dict, NULL, 0);
     memf = disc->memoryf;
     disc->memoryf = agdictobjmem;
     Ag_dictop_G = g;
     if (dtclose(dict))
        return 1;
     disc->memoryf = memf;
-    Ag_dictop_G = NIL(Agraph_t*);
+    Ag_dictop_G = NULL;
     return 0;
 }
 
 void agdtdisc(Agraph_t * g, Dict_t * dict, Dtdisc_t * disc)
 {
-    if (disc && (dtdisc(dict, NIL(Dtdisc_t *), 0) != disc)) {
+    if (disc && dtdisc(dict, NULL, 0) != disc) {
        dtdisc(dict, disc, 0);
     }
     /* else unchanged, disc is same as old disc */
index 84b90d202d98bfd155ffd385d446ff25b417a1fe..9ea93b0bc6c0be04c9ceba537a50e8090a32ee3a 100644 (file)
@@ -11,6 +11,7 @@
  * Contributors: See CVS logs. Details at http://www.graphviz.org/
  *************************************************************************/
 
+#include <stddef.h>
 #include <stdio.h>             /* need sprintf() */
 #include <ctype.h>
 #include <cgraph/cghdr.h>
@@ -62,7 +63,7 @@ static char *_agstrcanon(char *arg, char *buf)
     int backslash_pending = FALSE;
     static const char *tokenlist[]     /* must agree with scan.l */
        = { "node", "edge", "strict", "graph", "digraph", "subgraph",
-       NIL(char *)
+       NULL
     };
     const char **tok;
 
@@ -239,13 +240,13 @@ static int write_dict(Agraph_t * g, iochan_t * ofile, char *name,
     Agsym_t *sym, *psym;
 
     if (!top)
-       view = dtview(dict, NIL(Dict_t *));
+       view = dtview(dict, NULL);
     else
        view = 0;
     for (sym = (Agsym_t *) dtfirst(dict); sym;
         sym = (Agsym_t *) dtnext(dict, sym)) {
        if (EMPTY(sym->defval) && !sym->print) {        /* try to skip empty str (default) */
-           if (view == NIL(Dict_t *))
+           if (view == NULL)
                continue;       /* no parent */
            psym = (Agsym_t *) dtsearch(view, sym);
            assert(psym);
@@ -307,8 +308,8 @@ static int write_hdr(Agraph_t * g, iochan_t * ofile, int top)
            kind = "";
        if (agisstrict(g))
            strict = "strict ";
-       Tailport = agattr(g, AGEDGE, TAILPORT_ID, NIL(char *));
-       Headport = agattr(g, AGEDGE, HEADPORT_ID, NIL(char *));
+       Tailport = agattr(g, AGEDGE, TAILPORT_ID, NULL);
+       Headport = agattr(g, AGEDGE, HEADPORT_ID, NULL);
     }
     name = agnameof(g);
     sep = " ";
@@ -385,8 +386,7 @@ static int node_in_subg(Agraph_t * g, Agnode_t * n)
 
 static int has_no_edges(Agraph_t * g, Agnode_t * n)
 {
-    return ((agfstin(g, n) == NIL(Agedge_t *))
-           && (agfstout(g, n) == NIL(Agedge_t *)));
+    return agfstin(g, n) == NULL && agfstout(g, n) == NULL;
 }
 
 static int has_no_predecessor_below(Agraph_t * g, Agnode_t * n,
@@ -625,7 +625,7 @@ static int write_body(Agraph_t * g, iochan_t * ofile)
     Agdatadict_t *dd;
     /* int                  has_attr; */
 
-    /* has_attr = (agattrrec(g) != NIL(Agattr_t*)); */
+    /* has_attr = agattrrec(g) != NULL; */
 
     CHKRV(write_subgs(g, ofile));
     dd = agdatadict(g, FALSE);
index 31ea8931aca429becded59a61cdc80c06eb5dba5..e316357b473f97383bf4060f07c2ceee2bbbbd91 100644 (file)
@@ -16,6 +16,7 @@
 #include       <circogen/edgelist.h>
 #include       <circogen/nodeset.h>
 #include       <circogen/deglist.h>
+#include       <stddef.h>
 
 /* The code below lays out a single block on a circle.
  */
@@ -44,7 +45,7 @@ static Agraph_t *clone_graph(Agraph_t * ing, Agraph_t ** xg)
     clone = agsubg(ing, gname,1);
     agbindrec(clone, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);      //node custom data
     sprintf(gname, "_clone_%d", id++);
-    xclone = agopen(gname, ing->desc,NIL(Agdisc_t *));
+    xclone = agopen(gname, ing->desc,NULL);
     for (n = agfstnode(ing); n; n = agnxtnode(ing, n)) {
        agsubnode(clone,n,1);
        xn = agnode(xclone, agnameof(n),1);
index a132efe5e8da1154484991008ff7212056c6fe7e..b51b89b83856cc5738cd998d9d1bc53c0f5ab87c 100644 (file)
@@ -29,6 +29,7 @@
 #include    <neatogen/adjust.h>
 #include    <pack/pack.h>
 #include    <neatogen/neatoprocs.h>
+#include    <stddef.h>
 #include    <string.h>
 
 static void circular_init_edge(edge_t * e)
@@ -112,7 +113,7 @@ static Agraph_t **circomps(Agraph_t * g, int *cnt)
     Agedge_t *ep;
     Agnode_t *p;
 
-    dg = agopen("derived", Agstrictundirected,NIL(Agdisc_t *));
+    dg = agopen("derived", Agstrictundirected,NULL);
     agbindrec (dg, "info", sizeof(Agraphinfo_t), TRUE);
     GD_alg(g) = dg;  /* store derived graph for closing later */
 
index b4758d39a0ba3dc41a1d512aa3cdaca85ba49a62..f52f14a0376a520296837c5aa4d1fdec9e9c5bbc 100644 (file)
@@ -39,6 +39,7 @@
 #include <common/intset.h>
 #include <cdt/cdt.h>
 #include <cgraph/strcasecmp.h>
+#include <stddef.h>
 
 #define DEFAULT_BORDER    1
 #define DEFAULT_CELLPADDING  2
@@ -1553,8 +1554,8 @@ static void sizeArray(htmltbl_t * tbl)
     tbl->heights = N_NEW(tbl->rc + 1, int);
     tbl->widths = N_NEW(tbl->cc + 1, int);
 
-    rowg = agopen("rowg", dir, NIL(Agdisc_t *));
-    colg = agopen("colg", dir, NIL(Agdisc_t *));
+    rowg = agopen("rowg", dir, NULL);
+    colg = agopen("colg", dir, NULL);
     /* Only need GD_nlist */
     agbindrec(rowg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);       // graph custom data
     agbindrec(colg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);       // graph custom data
index 3a966a6e81ffff252b6aeaa3901e566044e50e34..6f58e3aba507751e22f903b4fd7e30a20e38879a 100644 (file)
@@ -18,6 +18,7 @@
 #include <xdot/xdot.h>
 #include <cgraph/agxbuf.h>
 #include <cgraph/strcasecmp.h>
+#include <stddef.h>
 
 static char *usageFmt =
     "Usage: %s [-Vv?] [-(GNE)name=val] [-(KTlso)<val>] <dot files>\n";
@@ -591,7 +592,7 @@ graph_t *gvNextInputGraph(GVC_t *gvc)
 #ifdef EXPERIMENTAL_MYFGETS
        g = agread_usergets(fp, myfgets);
 #else
-       g = agread(fp,NIL(Agdisc_t*));
+       g = agread(fp,NULL);
 #endif
        if (g) {
            gvg_init(gvc, g, fn, gidx++);
index 6052600668f4a65a7af702bfeed35e10dd11c3c7..d14a55226147c727a6184d9e5461d42e41e9bfe5 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <dotgen/dot.h>
 #include <math.h>
+#include <stddef.h>
 
 #ifdef ORTHO
 #include <ortho/ortho.h>
@@ -793,9 +794,9 @@ cloneGraph (graph_t* g, attr_state_t* attr_state)
     Agsym_t* sym;
     graph_t* auxg;
     if (agisdirected(g))
-       auxg = agopen ("auxg",Agdirected, NIL(Agdisc_t *));
+       auxg = agopen ("auxg",Agdirected, NULL);
     else
-       auxg = agopen ("auxg",Agundirected, NIL(Agdisc_t *));
+       auxg = agopen ("auxg",Agundirected, NULL);
     agbindrec(auxg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
     agattr(auxg, AGRAPH, "rank", "");
     GD_drawing(auxg) = NEW(layout_t);
index fc68bba400d8d13dfd75299009098a9949750aaa..d0cb5d61729ba2db138ee25daa86f72d59186e40 100644 (file)
@@ -572,13 +572,13 @@ static void gvevent_read (GVJ_t * job, const char *filename, const char *layout)
 
     gvc = job->gvc;
     if (!filename) {
-       g = agread(stdin,NIL(Agdisc_t *));  // continue processing stdin
+       g = agread(stdin,NULL);  // continue processing stdin
     }
     else {
        f = fopen(filename, "r");
        if (!f)
           return;   /* FIXME - need some error handling */
-       g = agread(f,NIL(Agdisc_t *));
+       g = agread(f,NULL);
        fclose(f);
     }
 
index de3b04866c935b868dbef8b7ab8e951de94d20bd..3f8c4f701383de99224037769bac9398c914035c 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "config.h"
 
+#include       <stddef.h>
 #include       <string.h>
 #include        <sys/types.h>
 #include        <sys/stat.h>
@@ -494,7 +495,7 @@ Agraph_t *gvplugin_graph(GVC_t * gvc)
     char bufa[100], *buf1, *buf2, bufb[100], *p, *q, *lq, *t;
     int api, neededge_loadimage, neededge_device;
 
-    g = agopen("G", Agdirected, NIL(Agdisc_t *));
+    g = agopen("G", Agdirected, NULL);
     agattr(g, AGRAPH, "label", "");
     agattr(g, AGRAPH, "rankdir", "");
     agattr(g, AGRAPH, "rank", "");
index 611618a822faa108752f49a774aa7d28bada7ab8..00908da06db4c36f222d815faa14a10566e09c81 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <neatogen/neato.h>
 #include <neatogen/adjust.h>
+#include <stddef.h>
 
 /* For precision, scale up before algorithms, then scale down */
 #define SCALE 10   
@@ -46,12 +47,12 @@ static Dtdisc_t constr = {
     offsetof(nitem, val),
     sizeof(int),
     offsetof(nitem, link),
-    NIL(Dtmake_f),
-    NIL(Dtfree_f),
+    NULL,
+    NULL,
     (Dtcompar_f) cmpitem,
-    NIL(Dthash_f),
-    NIL(Dtmemory_f),
-    NIL(Dtevent_f)
+    NULL,
+    NULL,
+    NULL
 };
 
 static int distY(box * b1, box * b2)
@@ -214,7 +215,7 @@ static graph_t *mkNConstraintG(graph_t * g, Dt_t * list,
     node_t *n;
     edge_t *e;
     node_t *lastn = NULL;
-    graph_t *cg = agopen("cg", Agstrictdirected, NIL(Agdisc_t *));
+    graph_t *cg = agopen("cg", Agstrictdirected, NULL);
     agbindrec(cg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);  // graph custom data
 
     for (p = (nitem *) dtflatten(list); p;
@@ -296,7 +297,7 @@ static graph_t *mkConstraintG(graph_t * g, Dt_t * list,
     int lcnt, cnt;
     int oldval = -INT_MAX;
     node_t *lastn = NULL;
-    graph_t *cg = agopen("cg", Agstrictdirected, NIL(Agdisc_t *));
+    graph_t *cg = agopen("cg", Agstrictdirected, NULL);
     agbindrec(cg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);  // graph custom data
 
     /* count distinct nodes */
@@ -352,7 +353,7 @@ static graph_t *mkConstraintG(graph_t * g, Dt_t * list,
      * Remaining outedges are immediate right neighbors.
      * FIX: Incremental algorithm to construct trans. reduction?
      */
-    vg = agopen("vg", Agstrictdirected, NIL(Agdisc_t *));
+    vg = agopen("vg", Agstrictdirected, NULL);
     for (p = (nitem *) dtflatten(list); p;
         p = (nitem *) dtlink(list, (Dtlink_t *) p)) {
        n = agnode(vg, agnameof(p->np), 1);  /* FIX */
index 05a1dc4651efddf01e930f5afc7c7223990b0232..1923971dc58145460d924b103d7fccfd5b628077 100644 (file)
@@ -11,7 +11,7 @@
  * Contributors: See CVS logs. Details at http://www.graphviz.org/
  *************************************************************************/
 
-
+#include <stddef.h>
 #include <stdio.h>
 #include <pathplan/vis.h>
 
@@ -254,10 +254,10 @@ static ilcoord_t Bezier(ilcoord_t * V, int degree, double t,
        }
     }
 
-    if (Left != NIL(ilcoord_t *))
+    if (Left != NULL)
        for (j = 0; j <= degree; j++)
            Left[j] = Vtemp[j][0];
-    if (Right != NIL(ilcoord_t *))
+    if (Right != NULL)
        for (j = 0; j <= degree; j++)
            Right[j] = Vtemp[degree - j][j];
     return (Vtemp[degree][0]);
index 0ba70e95a09c80bb7c4e0170d7d6eec539d97d5f..93d9e2dc27c0e06bc23d99a40c05e447e4783491 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 /*     Close a stream. A file stream is synced before closing.
 **
@@ -21,7 +22,7 @@
 int sfclose(Sfio_t * f)
 {
     int local, ex, rv;
-    void *data = NIL(void *);
+    void *data = NULL;
 
     SFMTXSTART(f, -1);
 
@@ -37,7 +38,7 @@ int sfclose(Sfio_t * f)
     while (f->push) {
        Sfio_t *pop;
 
-       if (!(pop = (*_Sfstack) (f, NIL(Sfio_t *))))
+       if (!(pop = (*_Sfstack) (f, NULL)))
            SFMTXRETURN(f, -1);
        if (sfclose(pop) < 0) {
            (*_Sfstack) (f, pop);
@@ -47,7 +48,7 @@ int sfclose(Sfio_t * f)
 
     rv = 0;
     if (f->disc == _Sfudisc)   /* closing the ungetc stream */
-       f->disc = NIL(Sfdisc_t *);
+       f->disc = NULL;
     else if (f->file >= 0) {   /* sync file pointer */
        f->bits |= SF_ENDING;
        rv = sfsync(f);
@@ -58,7 +59,7 @@ int sfclose(Sfio_t * f)
     /* raise discipline exceptions */
     if (f->disc
        && (ex =
-           SFRAISE(f, local ? SF_NEW : SF_CLOSING, NIL(void *))) != 0)
+           SFRAISE(f, local ? SF_NEW : SF_CLOSING, NULL)) != 0)
        SFMTXRETURN(f, ex);
 
     if (!local && f->pool) {   /* remove from pool */
@@ -83,14 +84,14 @@ int sfclose(Sfio_t * f)
            }
            f->mode |= SF_LOCK;
        }
-       f->pool = NIL(Sfpool_t *);
+       f->pool = NULL;
     }
 
     if (f->data && (!local || (f->flags & SF_STRING) || (f->bits & SF_MMAP))) {        /* free buffer */
        if (f->flags & SF_MALLOC)
            data = (void *) f->data;
 
-       f->data = NIL(uchar *);
+       f->data = NULL;
        f->size = -1;
     }
 
@@ -109,14 +110,14 @@ int sfclose(Sfio_t * f)
 
     /* zap any associated auxiliary buffer */
     free(f->rsrv);
-    f->rsrv = NIL(Sfrsrv_t *);
+    f->rsrv = NULL;
 
     /* delete any associated sfpopen-data */
     if (f->proc)
        rv = _sfpclose(f);
 
     if (!local) {
-       if (f->disc && (ex = SFRAISE(f, SF_FINAL, NIL(void *))) != 0) {
+       if (f->disc && (ex = SFRAISE(f, SF_FINAL, NULL)) != 0) {
            rv = ex;
            goto done;
        }
@@ -124,8 +125,8 @@ int sfclose(Sfio_t * f)
        if (!(f->flags & SF_STATIC))
            free(f);
        else {
-           f->disc = NIL(Sfdisc_t *);
-           f->stdio = NIL(void *);
+           f->disc = NULL;
+           f->stdio = NULL;
            f->mode = SF_AVAIL;
        }
     }
index 76df2b87e841a6730928c3f9605b3e8ed76a3506..7a2deb7206a0bcc8058fd1a391f72e6b6b9b7f40 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 /*     Set a new discipline for a stream.
 **
@@ -26,16 +27,16 @@ Sfdisc_t *sfdisc(Sfio_t * f, Sfdisc_t * disc)
     Sfseek_f oseekf;
     ssize_t n;
 
-    SFMTXSTART(f, NIL(Sfdisc_t *));
+    SFMTXSTART(f, NULL);
 
     if ((f->flags & SF_READ) && f->proc && (f->mode & SF_WRITE)) {     /* make sure in read mode to check for read-ahead data */
        if (_sfmode(f, SF_READ, 0) < 0)
-           SFMTXRETURN(f, NIL(Sfdisc_t *));
+           SFMTXRETURN(f, NULL);
     } else if ((f->mode & SF_RDWR) != f->mode && _sfmode(f, 0, 0) < 0)
-       SFMTXRETURN(f, NIL(Sfdisc_t *));
+       SFMTXRETURN(f, NULL);
 
     SFLOCK(f, 0);
-    rdisc = NIL(Sfdisc_t *);
+    rdisc = NULL;
 
     /* synchronize before switching to a new discipline */
     if (!(f->flags & SF_STRING)) {
@@ -50,7 +51,7 @@ Sfdisc_t *sfdisc(Sfio_t * f, Sfdisc_t * disc)
            int rv = 0;
 
            exceptf = disc ? disc->exceptf :
-               f->disc ? f->disc->exceptf : NIL(Sfexcept_f);
+               f->disc ? f->disc->exceptf : NULL;
 
            /* check with application for course of action */
            if (exceptf) {
@@ -68,7 +69,7 @@ Sfdisc_t *sfdisc(Sfio_t * f, Sfdisc_t * disc)
     /* save old readf, writef, and seekf to see if stream need reinit */
 #define GETDISCF(func,iof,type) \
        { for(d = f->disc; d && !d->iof; d = d->disc) ; \
-         func = d ? d->iof : NIL(type); \
+         func = d ? d->iof : NULL; \
        }
     GETDISCF(oreadf, readf, Sfread_f);
     GETDISCF(owritef, writef, Sfwrite_f);
@@ -110,7 +111,7 @@ Sfdisc_t *sfdisc(Sfio_t * f, Sfdisc_t * disc)
 
     if (!(f->flags & SF_STRING)) {     /* this stream may have to be reinitialized */
        int reinit = 0;
-#define DISCF(dst,iof,type)    (dst ? dst->iof : NIL(type))
+#define DISCF(dst,iof,type)    (dst ? dst->iof : NULL)
 #define REINIT(oiof,iof,type) \
                if(!reinit) \
                {       for(d = f->disc; d && !d->iof; d = d->disc) ; \
@@ -126,9 +127,9 @@ Sfdisc_t *sfdisc(Sfio_t * f, Sfdisc_t * disc)
            SETLOCAL(f);
            f->bits &= (unsigned short)~SF_NULL;        /* turn off /dev/null handling */
            if ((f->bits & SF_MMAP) || (f->mode & SF_INIT))
-               sfsetbuf(f, NIL(void *), (size_t) SF_UNBOUND);
+               sfsetbuf(f, NULL, (size_t) SF_UNBOUND);
            else if (f->data == f->tiny)
-               sfsetbuf(f, NIL(void *), 0);
+               sfsetbuf(f, NULL, 0);
            else {
                unsigned short flags = f->flags;
                sfsetbuf(f, (void *) f->data, f->size);
index d3dfc7aace043d92cca893461b570b04eff6a4de..dc5684657c39f352dbb2550c27733d5bcd5e2805 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 /*     Function to handle io exceptions.
 **     Written by Kiem-Phong Vo
@@ -103,7 +104,7 @@ int _sfexcept(Sfio_t * f, int type, ssize_t io, Sfdisc_t * disc)
            SFOPEN(f, 0);
 
        /* pop and close */
-       pf = (*_Sfstack) (f, NIL(Sfio_t *));
+       pf = (*_Sfstack) (f, NULL);
        if ((ev = sfclose(pf)) < 0)     /* can't close, restack */
            (*_Sfstack) (f, pf);
 
index 85fc83b1ba0b895e75562a0b3692b9d956aed0fa..752fd12b35c0729f3c3d6a784d881b4760f4239e 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 #include <stdint.h>
 static char *Version = "\n@(#)sfio (AT&T Labs - kpv) 2001-02-01\0\n";
 
@@ -52,7 +53,7 @@ static void _sfcleanup(void)
     /* set this so that no more buffering is allowed for write streams */
     _Sfexiting = 1001;
 
-    sfsync(NIL(Sfio_t *));
+    sfsync(NULL);
 
     for (p = &_Sfpool; p; p = p->next) {
        for (n = 0; n < p->n_sf; ++n) {
@@ -62,7 +63,7 @@ static void _sfcleanup(void)
            SFLOCK(f, 0);
 
            /* let application know that we are leaving */
-           (void) SFRAISE(f, SF_ATEXIT, NIL(void *));
+           (void) SFRAISE(f, SF_ATEXIT, NULL);
 
            if (f->flags & SF_STRING)
                continue;
@@ -74,7 +75,7 @@ static void _sfcleanup(void)
                (void) _sfmode(f, SF_WRITE, 1);
            if (((f->bits & SF_MMAP) && f->data) ||
                ((f->mode & SF_WRITE) && f->next == f->data))
-               (void) SFSETBUF(f, NIL(void *), 0);
+               (void) SFSETBUF(f, NULL, 0);
            f->mode |= pool;
 
            SFOPEN(f, 0);
@@ -153,7 +154,7 @@ Sfrsrv_t *_sfrsrv(Sfio_t * f, ssize_t size)
     if (rsrv && size > 0)
        rsrv->slen = 0;
 
-    return size >= 0 ? rsrv : NIL(Sfrsrv_t *);
+    return size >= 0 ? rsrv : NULL;
 }
 
 #ifdef SIGPIPE
@@ -181,7 +182,7 @@ int _sfpopen(Sfio_t * f, int fd, int pid, int stdio)
 
     p->pid = pid;
     p->size = p->ndata = 0;
-    p->rdata = NIL(uchar *);
+    p->rdata = NULL;
     p->file = fd;
     p->sigp = (!stdio && pid >= 0 && (f->flags & SF_WRITE)) ? 1 : 0;
 
@@ -209,7 +210,7 @@ int _sfpclose(Sfio_t * f)
 
     if (!(p = f->proc))
        return -1;
-    f->proc = NIL(Sfproc_t *);
+    f->proc = NULL;
 
     free(p->rdata);
 
@@ -327,7 +328,7 @@ int _sfmode(Sfio_t * f, int wanted, int local)
        (*_Sfstdsync) (f);
 
     if (f->disc == _Sfudisc && wanted == SF_WRITE &&
-       sfclose((*_Sfstack) (f, NIL(Sfio_t *))) < 0) {
+       sfclose((*_Sfstack) (f, NULL)) < 0) {
        local = 1;
        goto err_notify;
     }
@@ -456,7 +457,7 @@ int _sfmode(Sfio_t * f, int wanted, int local)
 
        f->mode = SF_WRITE | SF_LOCK;
        if (f->data == f->tiny) {
-           f->endb = f->data = f->next = NIL(uchar *);
+           f->endb = f->data = f->next = NULL;
            f->size = 0;
        } else
            f->endb = (f->next = f->data) + f->size;
index b982ccb2bc15cbb3f9a57ec5340736de3d9f4676..1ad239fc950ffc722c5e62c2f755234c17d278b2 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 /*     Fundamental function to create a new stream.
 **     The argument flags defines the type of stream and the scheme
@@ -34,29 +35,29 @@ Sfio_t *sfnew(Sfio_t * oldf, void * buf, size_t size, int file,
     int sflags;
 
     if (!(flags & SF_RDWR))
-       return NIL(Sfio_t *);
+       return NULL;
 
     sflags = 0;
     if ((f = oldf)) {
        if (flags & SF_EOF) {
-           oldf = NIL(Sfio_t *);
+           oldf = NULL;
        } else if (f->mode & SF_AVAIL) {        /* only allow SF_STATIC to be already closed */
            if (!(f->flags & SF_STATIC))
-               return NIL(Sfio_t *);
+               return NULL;
            sflags = f->flags;
-           oldf = NIL(Sfio_t *);
+           oldf = NULL;
        } else {                /* reopening an open stream, close it first */
            sflags = f->flags;
 
            if (((f->mode & SF_RDWR) != f->mode && _sfmode(f, 0, 0) < 0) ||
                SFCLOSE(f) < 0)
-               return NIL(Sfio_t *);
+               return NULL;
 
            if (f->data
                && ((flags & SF_STRING) || size != (size_t) SF_UNBOUND)) {
                if (sflags & SF_MALLOC)
                    free(f->data);
-               f->data = NIL(uchar *);
+               f->data = NULL;
            }
            if (!f->data)
                sflags &= (unsigned short)~SF_MALLOC;
@@ -70,13 +71,13 @@ Sfio_t *sfnew(Sfio_t * oldf, void * buf, size_t size, int file,
                if (f->mode & SF_AVAIL) {
                    sflags = f->flags;
                } else
-                   f = NIL(Sfio_t *);
+                   f = NULL;
            }
        }
 
        if (!f) {
            if (!(f = malloc(sizeof(Sfio_t))))
-               return NIL(Sfio_t *);
+               return NULL;
            SFCLEAR(f);
        }
     }
@@ -92,7 +93,7 @@ Sfio_t *sfnew(Sfio_t * oldf, void * buf, size_t size, int file,
     f->mode |= SF_INIT;
     if (size != (size_t) SF_UNBOUND) {
        f->size = size;
-       f->data = size <= 0 ? NIL(uchar *) : (uchar *) buf;
+       f->data = size <= 0 ? NULL : (uchar *) buf;
     }
     f->endb = f->endr = f->endw = f->next = f->data;
 
index ba7d499891f472723d4d2c6fba423c926a3d8fed..b2b2e9af2d2c20ebec933a1dad2e39f0562f76fa 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 #ifdef _WIN32
 #include       <io.h>
 #endif
@@ -33,14 +34,14 @@ Sfio_t *sfopen(Sfio_t * f, const char *file, const char *mode)
     int fd, oldfd, oflags, sflags;
 
     /* get the control flags */
-    if ((sflags = _sftype(mode, &oflags, NIL(int *))) == 0)
-       return NIL(Sfio_t *);
+    if ((sflags = _sftype(mode, &oflags, NULL)) == 0)
+       return NULL;
 
     /* usually used on the standard streams to change control flags */
 
 #ifndef _WIN32 
     if (f && !file && (f->mode & SF_INIT)) {
-       SFMTXSTART(f, NIL(Sfio_t *));
+       SFMTXSTART(f, NULL);
 
        if (f->mode & SF_INIT) {        /* paranoia in case another thread snuck in */
            if (f->file >= 0 && !(f->flags & SF_STRING) && (oflags &= (O_TEXT | O_BINARY | O_APPEND)) != 0) {   /* set the wanted file access control flags */
@@ -68,7 +69,7 @@ Sfio_t *sfopen(Sfio_t * f, const char *file, const char *mode)
 
            SFMTXRETURN(f, f);
        } else
-           SFMTXRETURN(f, NIL(Sfio_t *));
+           SFMTXRETURN(f, NULL);
     }
 
 #endif
@@ -78,7 +79,7 @@ Sfio_t *sfopen(Sfio_t * f, const char *file, const char *mode)
                  SF_UNBOUND, -1, sflags);
     } else {
        if (!file)
-           return NIL(Sfio_t *);
+           return NULL;
 
 #if _has_oflags                        /* open the file */
        while ((fd = open(file, oflags, SF_CREATMODE)) < 0
@@ -91,7 +92,7 @@ Sfio_t *sfopen(Sfio_t * f, const char *file, const char *mode)
        if (fd >= 0) {
            if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) {
                CLOSE(fd);      /* error: file already exists */
-               return NIL(Sfio_t *);
+               return NULL;
            }
            if (oflags & O_TRUNC) {     /* truncate file */
                int tf;
@@ -112,11 +113,11 @@ Sfio_t *sfopen(Sfio_t * f, const char *file, const char *mode)
        }
 #endif
        if (fd < 0)
-           return NIL(Sfio_t *);
+           return NULL;
 
        /* we may have to reset the file descriptor to its old value */
        oldfd = f ? f->file : -1;
-       if ((f = sfnew(f, NIL(char *), (size_t) SF_UNBOUND, fd, sflags))
+       if ((f = sfnew(f, NULL, (size_t) SF_UNBOUND, fd, sflags))
            && oldfd >= 0)
             (void) sfsetfd(f, oldfd);
     }
index 401373448c94f901ce868cda94bc1f0523d12848..d8661e12b84ba956c3b99ced6bc5aa10d05d634e 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 #ifdef HAVE_SYS_IOCTL_H
 #include       <sys/ioctl.h>
 #endif
@@ -66,7 +67,7 @@ ssize_t sfpkrd(int fd, void * argbuf, size_t n, int rc, long tm,
            pbuf.flags = 0;
            pbuf.ctlbuf.maxlen = -1;
            pbuf.ctlbuf.len = 0;
-           pbuf.ctlbuf.buf = NIL(char *);
+           pbuf.ctlbuf.buf = NULL;
            pbuf.databuf.maxlen = n;
            pbuf.databuf.buf = buf;
            pbuf.databuf.len = 0;
@@ -107,13 +108,13 @@ ssize_t sfpkrd(int fd, void * argbuf, size_t n, int rc, long tm,
                FD_ZERO(&rd);
                FD_SET(fd, &rd);
                if (tm < 0)
-                   tmp = NIL(struct timeval *);
+                   tmp = NULL;
                else {
                    tmp = &tmb;
                    tmb.tv_sec = tm / SECOND;
                    tmb.tv_usec = (tm % SECOND) * SECOND;
                }
-               r = select(fd + 1, &rd, NIL(fd_set *), NIL(fd_set *), tmp);
+               r = select(fd + 1, &rd, NULL, NULL, tmp);
                if (r < 0) {
                    if (errno == EINTR)
                        return -1;
index ed7257575f72ae445da936cc3e3f5194dd952033..a5330e15ce97c308590c46235c0fbf1294f2320b 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 /*     Put out a null-terminated string
 **
@@ -76,7 +77,7 @@ ssize_t sfputr(Sfio_t * f, const char *s, int rc)
            w += 1;
            break;
        }
-       if ((ps = (uchar *) memccpy(ps, s, '\0', p)) != NIL(uchar *))
+       if ((ps = (uchar *) memccpy(ps, s, '\0', p)) != NULL)
            ps -= 1;
        else
            ps = f->next + p;
index bcf81c862cc8aed729ada15ab1fbccd86c89c01a..9e2a2d1ccd6f218bc575ec20c0e41fac08373686 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 /*     Set the IO pointer to a specific location in the stream
 **
@@ -81,7 +82,7 @@ Sfoff_t sfseek(Sfio_t * f, Sfoff_t p, int type)
 
     /* throw away ungetc data */
     if (f->disc == _Sfudisc)
-       (void) sfclose((*_Sfstack) (f, NIL(Sfio_t *)));
+       (void) sfclose((*_Sfstack) (f, NULL));
 
     /* lock the stream for internal manipulations */
     SFLOCK(f, local);
index 5445c571ade43058cf9c73cedd5180f127def9be..56d3ef951913a6906e1e953dd93861fc4f068b6f 100644 (file)
@@ -11,6 +11,8 @@
  * Contributors: See CVS logs. Details at http://www.graphviz.org/
  *************************************************************************/
 
+#include <stddef.h>
+
 #if defined(__STDPP__directive) && defined(__STDPP__hide)
 __STDPP__directive pragma pp:hide getpagesize
 #else
@@ -63,7 +65,7 @@ void *sfsetbuf(Sfio_t * f, void * buf, size_t size)
     int oflags, init, local;
     Stat_t st;
 
-    SFMTXSTART(f, NIL(void *));
+    SFMTXSTART(f, NULL);
 
     GETLOCAL(f, local);
 
@@ -75,16 +77,16 @@ void *sfsetbuf(Sfio_t * f, void * buf, size_t size)
 
     /* cleanup actions already done, don't allow write buffering any more */
     if (_Sfexiting && !(f->flags & SF_STRING) && (f->mode & SF_WRITE)) {
-       buf = NIL(void *);
+       buf = NULL;
        size = 0;
     }
 
     if ((init = f->mode & SF_INIT)) {
        if (!f->pool && _sfsetpool(f) < 0)
-           SFMTXRETURN(f, NIL(void *));
+           SFMTXRETURN(f, NULL);
     } else if ((f->mode & SF_RDWR) != SFMODE(f, local)
               && _sfmode(f, 0, local) < 0)
-       SFMTXRETURN(f, NIL(void *));
+       SFMTXRETURN(f, NULL);
 
     if (init)
        f->mode = (f->mode & SF_RDWR) | SF_LOCK;
@@ -94,14 +96,14 @@ void *sfsetbuf(Sfio_t * f, void * buf, size_t size)
        /* make sure there is no hidden read data */
        if (f->proc && (f->flags & SF_READ) && (f->mode & SF_WRITE) &&
            _sfmode(f, SF_READ, local) < 0)
-           SFMTXRETURN(f, NIL(void *));
+           SFMTXRETURN(f, NULL);
 
        /* synchronize first */
        SFLOCK(f, local);
        rv = SFSYNC(f);
        SFOPEN(f, local);
        if (rv < 0)
-           SFMTXRETURN(f, NIL(void *));
+           SFMTXRETURN(f, NULL);
 
        /* turn off the SF_SYNCED bit because buffer is changing */
        f->mode &= ~SF_SYNCED;
@@ -113,7 +115,7 @@ void *sfsetbuf(Sfio_t * f, void * buf, size_t size)
     oflags = f->flags;
 
     if (f->data == f->tiny) {
-       f->data = NIL(uchar *);
+       f->data = NULL;
        f->size = 0;
     }
     obuf = f->data;
@@ -224,14 +226,14 @@ void *sfsetbuf(Sfio_t * f, void * buf, size_t size)
        else if ((ssize_t) (size = _Sfpage) < blksize)
            size = blksize;
 
-       buf = NIL(void *);
+       buf = NULL;
     }
 
     sf_malloc = 0;
     if (size > 0 && !buf && !(f->bits & SF_MMAP)) {    /* try to allocate a buffer */
        if (obuf && size == (size_t) osize && init) {
            buf = (void *) obuf;
-           obuf = NIL(uchar *);
+           obuf = NULL;
            sf_malloc = (oflags & SF_MALLOC);
        }
        if (!buf) {             /* do allocation */
@@ -270,7 +272,7 @@ void *sfsetbuf(Sfio_t * f, void * buf, size_t size)
 
     if (obuf && obuf != f->data && osize > 0 && (oflags & SF_MALLOC)) {
        free(obuf);
-       obuf = NIL(uchar *);
+       obuf = NULL;
     }
 
     _Sfi = f->val = obuf ? osize : 0;
index c5f9462c64db6414030117d49698ee8ef3e501df..a84de22860469c445f95698ad4f5b2f4d404d475 100644 (file)
@@ -76,7 +76,7 @@ Sfio_t *sfstack(Sfio_t * f1, Sfio_t * f2)
        rf = f1;
     } else {                   /* unfreeze the just exposed stream */
        f1->mode &= ~SF_PUSH;
-       f2->push = NIL(Sfio_t *);
+       f2->push = NULL;
        rf = f2;
     }
 
index 0ed17c3afb9d6095a8a74f10ec2ba2c83ce2cb68..04317842181c269a62b701aa8aef8cfd6e0c62a3 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 /*     Swap two streams. If the second argument is NULL,
 **     a new stream will be created. Always return the second argument
@@ -29,9 +30,9 @@ Sfio_t *sfswap(Sfio_t * f1, Sfio_t * f2)
 
     if (!f1 || (f1->mode & SF_AVAIL)
        || (SFFROZEN(f1) && (f1->mode & SF_PUSH)))
-       return NIL(Sfio_t *);
+       return NULL;
     if (f2 && SFFROZEN(f2) && (f2->mode & SF_PUSH))
-       return NIL(Sfio_t *);
+       return NULL;
     if (f1 == f2)
        return f2;
 
@@ -46,12 +47,12 @@ Sfio_t *sfswap(Sfio_t * f1, Sfio_t * f2)
     } else {
        f2 = f1->file == 0 ? sfstdin :
            f1->file == 1 ? sfstdout :
-           f1->file == 2 ? sfstderr : NIL(Sfio_t *);
+           f1->file == 2 ? sfstderr : NULL;
        if ((!f2 || !(f2->mode & SF_AVAIL))) {
            if (!(f2 = malloc(sizeof(Sfio_t)))) {
                f1->mode = f1mode;
                SFOPEN(f1, 0);
-               return NIL(Sfio_t *);
+               return NULL;
            }
 
            SFCLEAR(f2);
index 256b1de0b25f7c19b8c5b607b4d21190235cea55..24ac670935f72f705e3ba9ab135ea6619e52439b 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 /*     Synchronize data in buffers with the file system.
 **     If f is nil, all streams are sync-ed
@@ -82,7 +83,7 @@ int sfsync(Sfio_t * f)
     GETLOCAL(origf, local);
 
     if (origf->disc == _Sfudisc)       /* throw away ungetc */
-       (void) sfclose((*_Sfstack) (origf, NIL(Sfio_t *)));
+       (void) sfclose((*_Sfstack) (origf, NULL));
 
     rv = 0;
 
index f70c476c4bec46a2eb19fc7194dd18a309fd89cd..6b94d2b0544449d927bdea5b8c6d8765b25c4002 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 /*     Dealing with $ argument addressing stuffs.
 **
@@ -39,9 +40,9 @@ static Fmtpos_t *sffmtpos(Sfio_t * f, const char *form, va_list args,
     int argp, argn, maxp, need[FP_INDEX];
 
     if (type < 0)
-       fp = NIL(Fmtpos_t *);
+       fp = NULL;
     else if (!(fp = sffmtpos(f, form, args, -1)))
-       return NIL(Fmtpos_t *);
+       return NULL;
 
     dollar = 0;
     decimal = thousand = 0;
@@ -76,7 +77,7 @@ static Fmtpos_t *sffmtpos(Sfio_t * f, const char *form, va_list args,
        }
 
        flags = dot = 0;
-       t_str = NIL(char *);
+       t_str = NULL;
        n_str = 0;
        size = width = precis = base = -1;
        for (n = 0; n < FP_INDEX; ++n)
@@ -90,7 +91,7 @@ static Fmtpos_t *sffmtpos(Sfio_t * f, const char *form, va_list args,
                switch (*form++) {
                case 0: /* not balancable, retract */
                    form = t_str;
-                   t_str = NIL(char *);
+                   t_str = NULL;
                    n_str = 0;
                    goto loop_flags;
                case LEFTP:     /* increasing nested level */
@@ -263,7 +264,7 @@ static Fmtpos_t *sffmtpos(Sfio_t * f, const char *form, va_list args,
            maxp = argp;
 
        if (dollar && fmt == '!')
-           return NIL(Fmtpos_t *);
+           return NULL;
 
        if (fp && fp[argp].ft.fmt == 0) {
            fp[argp].ft.form = (char *) form;
@@ -283,14 +284,14 @@ static Fmtpos_t *sffmtpos(Sfio_t * f, const char *form, va_list args,
     if (!fp) {                 /* constructing position array only */
        if (!dollar
            || !(fp = malloc((maxp + 1) * sizeof(Fmtpos_t))))
-           return NIL(Fmtpos_t *);
+           return NULL;
        for (n = 0; n <= maxp; ++n)
            fp[n].ft.fmt = 0;
        return fp;
     }
 
     /* get value for positions */
-    for (n = 0, ft = NIL(Sffmt_t *); n <= maxp; ++n) {
+    for (n = 0, ft = NULL; n <= maxp; ++n) {
        if (fp[n].ft.fmt == 0) {        /* gap: pretend it's a 'd' pattern */
            fp[n].ft.fmt = 'd';
            fp[n].ft.width = 0;
@@ -327,7 +328,7 @@ static Fmtpos_t *sffmtpos(Sfio_t * f, const char *form, va_list args,
            memcpy(&fp[n].ft, ft, sizeof(Sffmt_t));
            if (v < 0) {
                memcpy(ft, &savft, sizeof(Sffmt_t));
-               ft = NIL(Sffmt_t *);
+               ft = NULL;
            }
 
            if (!(fp[n].ft.flags & SFFMT_VALUE))
@@ -344,7 +345,7 @@ static Fmtpos_t *sffmtpos(Sfio_t * f, const char *form, va_list args,
                    memcpy(ft, &savft, sizeof(Sffmt_t));
                fp[n].argv.ft = ft = va_arg(args, Sffmt_t *);
                if (ft->form)
-                   ft = NIL(Sffmt_t *);
+                   ft = NULL;
                if (ft)
                    memcpy(&savft, ft, sizeof(Sffmt_t));
            } else if (type > 0)        /* from sfvscanf */
index 6ef7d3d03379b7a0b75477fbb2bcc3e7778b285c..9fc9894141179c4020936569c7bbe2ffe69cc5d8 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 char **_sfgetpath(char *path)
 {
@@ -19,7 +20,7 @@ char **_sfgetpath(char *path)
     int n;
 
     if (!(path = getenv(path)))
-       return NIL(char **);
+       return NULL;
 
     for (p = path, n = 0;;) {  /* count number of directories */
        while (*p == ':')
@@ -31,10 +32,10 @@ char **_sfgetpath(char *path)
            ++p;
     }
     if (n == 0 || !(dirs = malloc((n + 1) * sizeof(char *))))
-       return NIL(char **);
+       return NULL;
     if (!(p = malloc(strlen(path) + 1))) {
        free(dirs);
-       return NIL(char **);
+       return NULL;
     }
     strcpy(p, path);
     for (n = 0;; ++n) {
@@ -48,7 +49,7 @@ char **_sfgetpath(char *path)
        if (*p == ':')
            *p++ = 0;
     }
-    dirs[n] = NIL(char *);
+    dirs[n] = NULL;
 
     return dirs;
 }
index 31f79d10567f9716f2181bded11898c1663f65bc..b9a875cffb892f5aac9f7594491aadc0e3be098c 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 /*     Push back one byte to a given SF_READ stream
 **
@@ -28,7 +29,7 @@ static int _uexcept(Sfio_t * f, int type, void * val,
 
     /* close the unget stream */
     if (type != SF_CLOSING)
-       (void) sfclose((*_Sfstack) (f, NIL(Sfio_t *)));
+       (void) sfclose((*_Sfstack) (f, NULL));
 
     return 1;
 }
@@ -55,7 +56,7 @@ int sfungetc(Sfio_t * f, int c)
 
     /* make a string stream for unget characters */
     if (f->disc != _Sfudisc) {
-       if (!(uf = sfnew(NIL(Sfio_t *), NIL(char *), (size_t) SF_UNBOUND,
+       if (!(uf = sfnew(NULL, NULL, (size_t) SF_UNBOUND,
                         -1, SF_STRING | SF_READ))) {
            c = -1;
            goto done;
index c837a87ca85e673833e19064e98f984100ee4656..ad1c23db71aa30cea02a74979977aedf40bbd2ac 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <inttypes.h>
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 /*     The engine for formatting data
 **
@@ -105,14 +106,14 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args)
     }
     SFINIT(f);
 
-    tls[1] = NIL(char *);
+    tls[1] = NULL;
 
-    fmstk = NIL(Fmt_t *);
-    ft = NIL(Sffmt_t *);
+    fmstk = NULL;
+    ft = NULL;
 
     oform = (char *) form;
     va_copy(oargs, args);
-    fp = NIL(Fmtpos_t *);
+    fp = NULL;
     argn = -1;
 
   loop_fmt:
@@ -130,9 +131,9 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args)
        flags = 0;
        size = width = precis = base = n_s = argp = -1;
        ssp = _Sfdigits;
-       endep = ep = NIL(char *);
+       endep = ep = NULL;
        endsp = sp = buf + (sizeof(buf) - 1);
-       t_str = NIL(char *);
+       t_str = NULL;
        n_str = dot = 0;
 
       loop_flags:              /* LOOP FOR \0, %, FLAGS, WIDTH, PRECISION, BASE, TYPE */
@@ -150,7 +151,7 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args)
                switch (*form++) {
                case 0: /* not balancable, retract */
                    form = t_str;
-                   t_str = NIL(char *);
+                   t_str = NULL;
                    n_str = 0;
                    goto loop_flags;
                case LEFTP:     /* increasing nested level */
@@ -176,7 +177,7 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args)
                            n_str = fp[n].ft.size;
                        } else if (ft && ft->extf) {
                            FMTSET(ft, form, args,
-                                  LEFTP, 0, 0, 0, 0, 0, NIL(char *), 0);
+                                  LEFTP, 0, 0, 0, 0, 0, NULL, 0);
                            n = (*ft->extf)
                                (f, (void *) & argv, ft);
                            if (n < 0)
@@ -259,7 +260,7 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args)
            if (fp)
                v = fp[n].argv.i;
            else if (ft && ft->extf) {
-               FMTSET(ft, form, args, '.', dot, 0, 0, 0, 0, NIL(char *),
+               FMTSET(ft, form, args, '.', dot, 0, 0, 0, 0, NULL,
                       0);
                if ((*ft->extf) (f, (void *) (&argv), ft) < 0)
                    goto pop_fmt;
@@ -322,7 +323,7 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args)
                    size = fp[n].argv.i;
                else if (ft && ft->extf) {
                    FMTSET(ft, form, args, 'I', sizeof(int), 0, 0, 0, 0,
-                          NIL(char *), 0);
+                          NULL, 0);
                    if ((*ft->extf) (f, (void *) (&argv), ft) < 0)
                        goto pop_fmt;
                    if (ft->flags & SFFMT_VALUE)
@@ -476,9 +477,9 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args)
                    form = argv.ft->form;
                    va_copy(args, argv.ft->args);
                    argn = -1;
-                   fp = NIL(Fmtpos_t *);
+                   fp = NULL;
                } else
-                   fm->form = NIL(char *);
+                   fm->form = NULL;
 
                fm->eventf = argv.ft->eventf;
                fm->ft = ft;
@@ -958,11 +959,11 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args)
 
   pop_fmt:
     free(fp);
-    fp = NIL(Fmtpos_t *);
+    fp = NULL;
     while ((fm = fmstk)) {     /* pop the format stack and continue */
        if (fm->eventf) {
            if (!form || !form[0])
-               (*fm->eventf) (f, SF_FINAL, NIL(void *), ft);
+               (*fm->eventf) (f, SF_FINAL, NULL, ft);
            else if ((*fm->eventf) (f, SF_DPOP, (void *) form, ft) < 0)
                goto loop_fmt;
        }
@@ -985,7 +986,7 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args)
     free(fp);
     while ((fm = fmstk)) {
        if (fm->eventf)
-           (*fm->eventf) (f, SF_FINAL, NIL(void *), fm->ft);
+           (*fm->eventf) (f, SF_FINAL, NULL, fm->ft);
        fmstk = fm->next;
        free(fm);
     }
@@ -994,7 +995,7 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args)
 
     n = f->next - f->data;
     if ((d = f->data) == (uchar *) data)
-       f->endw = f->endr = f->endb = f->data = NIL(uchar *);
+       f->endw = f->endr = f->endb = f->data = NULL;
     f->next = f->data;
 
     if ((((flags = f->flags) & SF_SHARE) && !(flags & SF_PUBLIC)) ||
index 3145656222b9e76a6e0e6d241de40b4103fb3cce..fa55b4f0b231d43077f7cbf7fe11aec1c461dfc9 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <inttypes.h>
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 /*     The main engine for reading formatted data
 **
@@ -127,10 +128,10 @@ int sfvscanf(Sfio_t * f, const char *form, va_list args)
 
     inp = -1;
 
-    fmstk = NIL(Fmt_t *);
-    ft = NIL(Sffmt_t *);
+    fmstk = NULL;
+    ft = NULL;
 
-    fp = NIL(Fmtpos_t *);
+    fp = NULL;
     argn = -1;
     oform = (char *) form;
     va_copy(oargs, args);
@@ -178,9 +179,9 @@ int sfvscanf(Sfio_t * f, const char *form, va_list args)
        base = 10;
        size = -1;
        width = dot = 0;
-       t_str = NIL(char *);
+       t_str = NULL;
        n_str = 0;
-       value = NIL(void *);
+       value = NULL;
        argp = -1;
 
       loop_flags:              /* LOOP FOR FLAGS, WIDTH, BASE, TYPE */
@@ -191,7 +192,7 @@ int sfvscanf(Sfio_t * f, const char *form, va_list args)
                switch (*form++) {
                case 0: /* not balanceable, retract */
                    form = t_str;
-                   t_str = NIL(char *);
+                   t_str = NULL;
                    n_str = 0;
                    goto loop_flags;
                case LEFTP:     /* increasing nested level */
@@ -217,7 +218,7 @@ int sfvscanf(Sfio_t * f, const char *form, va_list args)
                            n_str = fp[n].ft.size;
                        } else if (ft && ft->extf) {
                            FMTSET(ft, form, args,
-                                  LEFTP, 0, 0, 0, 0, 0, NIL(char *), 0);
+                                  LEFTP, 0, 0, 0, 0, 0, NULL, 0);
                            n = (*ft->extf)
                                (f, (void *) & argv, ft);
                            if (n < 0)
@@ -260,7 +261,7 @@ int sfvscanf(Sfio_t * f, const char *form, va_list args)
                    v = fp[n].argv.i;
                else if (ft && ft->extf) {
                    FMTSET(ft, form, args, '.', dot, 0, 0, 0, 0,
-                          NIL(char *), 0);
+                          NULL, 0);
                    if ((*ft->extf) (f, (void *) (&argv), ft) < 0)
                        goto pop_fmt;
                    if (ft->flags & SFFMT_VALUE)
@@ -324,7 +325,7 @@ int sfvscanf(Sfio_t * f, const char *form, va_list args)
                    size = fp[n].argv.i;
                else if (ft && ft->extf) {
                    FMTSET(ft, form, args, 'I', sizeof(int), 0, 0, 0, 0,
-                          NIL(char *), 0);
+                          NULL, 0);
                    if ((*ft->extf) (f, (void *) (&argv), ft) < 0)
                        goto pop_fmt;
                    if (ft->flags & SFFMT_VALUE)
@@ -454,9 +455,9 @@ int sfvscanf(Sfio_t * f, const char *form, va_list args)
                    form = argv.ft->form;
                    va_copy(args, argv.ft->args);
                    argn = -1;
-                   fp = NIL(Fmtpos_t *);
+                   fp = NULL;
                } else
-                   fm->form = NIL(char *);
+                   fm->form = NULL;
 
                fm->eventf = argv.ft->eventf;
                fm->ft = ft;
@@ -535,7 +536,7 @@ int sfvscanf(Sfio_t * f, const char *form, va_list args)
 
            if (value) {
                *val = '\0';
-                   argv.d = (double) strtod(accept, NIL(char **));
+                   argv.d = (double) strtod(accept, NULL);
            }
 
            if (value) {
@@ -729,11 +730,11 @@ int sfvscanf(Sfio_t * f, const char *form, va_list args)
 
   pop_fmt:
     free(fp);
-    fp = NIL(Fmtpos_t *);
+    fp = NULL;
     while ((fm = fmstk)) {     /* pop the format stack and continue */
        if (fm->eventf) {
            if (!form || !form[0])
-               (*fm->eventf) (f, SF_FINAL, NIL(void *), ft);
+               (*fm->eventf) (f, SF_FINAL, NULL, ft);
            else if ((*fm->eventf) (f, SF_DPOP, (void *) form, ft) < 0)
                goto loop_fmt;
        }
@@ -756,7 +757,7 @@ int sfvscanf(Sfio_t * f, const char *form, va_list args)
     free(fp);
     while ((fm = fmstk)) {
        if (fm->eventf)
-           (*fm->eventf) (f, SF_FINAL, NIL(void *), fm->ft);
+           (*fm->eventf) (f, SF_FINAL, NULL, fm->ft);
        fmstk = fm->next;
        free(fm);
     }
index 9144e2d8bfebea7f5b6dcd533b0cb101154ffb5f..9854616a74fcea09f8cfd51b1809cfffb7c4b8f1 100644 (file)
@@ -12,6 +12,7 @@
  *************************************************************************/
 
 #include       <sfio/sfhdr.h>
+#include       <stddef.h>
 
 /*     Write with discipline.
 **
@@ -86,7 +87,7 @@ static ssize_t sfoutput(Sfio_t * f, char *buf, size_t n)
        /* seek to a rounded boundary within the hole */
        if (s >= _Sfpage) {
            s = (s / _Sfpage) * _Sfpage;
-           if (SFSK(f, (Sfoff_t) s, SEEK_CUR, NIL(Sfdisc_t *)) < 0)
+           if (SFSK(f, (Sfoff_t) s, SEEK_CUR, NULL) < 0)
                break;
            w += s;
            n -= s;