Ignore:
Timestamp:
Nov 26, 2002, 10:24:54 PM (23 years ago)
Author:
bird
Message:

Import of RELENG_4_7_0_RELEASE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/FREEBSD/src/kmk/suff.c

    r10 r24  
    3535 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    3636 * SUCH DAMAGE.
    37  *
    38  * @(#)suff.c   8.4 (Berkeley) 3/21/94
    39  */
    40 
    41 #include <sys/cdefs.h>
    42 __FBSDID("$FreeBSD: src/usr.bin/make/suff.c,v 1.26 2002/10/09 03:42:10 jmallett Exp $");
     37 */
     38
     39#ifndef lint
     40#if 0
     41static char sccsid[] = "@(#)suff.c      8.4 (Berkeley) 3/21/94";
     42#else
     43static const char rcsid[] =
     44  "$FreeBSD: src/usr.bin/make/suff.c,v 1.12.2.1 2001/03/09 01:13:24 tmm Exp $";
     45#endif
     46#endif /* not lint */
    4347
    4448/*-
     
    8993 *      Suff_FindDeps           Find implicit sources for and the location of
    9094 *                              a target based on its suffix. Returns the
    91  *                              bottom-most node added to the graph or NULL
     95 *                              bottom-most node added to the graph or NILGNODE
    9296 *                              if the target had no implicit sources.
    9397 */
     
    112116    int          nameLen;       /* Length of the suffix */
    113117    short        flags;         /* Type of suffix */
    114 #define SUFF_INCLUDE      0x01      /* One which is #include'd */
    115 #define SUFF_LIBRARY      0x02      /* One which contains a library */
    116 #define SUFF_NULL         0x04      /* The empty suffix */
     118#define SUFF_INCLUDE      0x01      /* One which is #include'd */
     119#define SUFF_LIBRARY      0x02      /* One which contains a library */
     120#define SUFF_NULL         0x04      /* The empty suffix */
    117121    Lst          searchPath;    /* The path along which files of this suffix
    118122                                 * may be found */
     
    154158
    155159
    156 static char *SuffStrIsPrefix(char *, char *);
    157 static char *SuffSuffIsSuffix(Suff *, char *);
    158 static int SuffSuffIsSuffixP(void *, void *);
    159 static int SuffSuffHasNameP(void *, void *);
    160 static int SuffSuffIsPrefix(void *, void *);
    161 static int SuffGNHasNameP(void *, void *);
    162 static void SuffFree(void *);
    163 static void SuffInsert(Lst, Suff *);
    164 static void SuffRemove(Lst, Suff *);
    165 static Boolean SuffParseTransform(char *, Suff **, Suff **);
    166 static int SuffRebuildGraph(void *, void *);
    167 static int SuffAddSrc(void *, void *);
    168 static int SuffRemoveSrc(Lst);
    169 static void SuffAddLevel(Lst, Src *);
    170 static Src *SuffFindThem(Lst, Lst);
    171 static Src *SuffFindCmds(Src *, Lst);
    172 static int SuffExpandChildren(void *, void *);
    173 static Boolean SuffApplyTransform(GNode *, GNode *, Suff *, Suff *);
    174 static void SuffFindDeps(GNode *, Lst);
    175 static void SuffFindArchiveDeps(GNode *, Lst);
    176 static void SuffFindNormalDeps(GNode *, Lst);
    177 static int SuffPrintName(void *, void *);
    178 static int SuffPrintSuff(void *, void *);
    179 static int SuffPrintTrans(void *, void *);
     160static char *SuffStrIsPrefix __P((char *, char *));
     161static char *SuffSuffIsSuffix __P((Suff *, char *));
     162static int SuffSuffIsSuffixP __P((ClientData, ClientData));
     163static int SuffSuffHasNameP __P((ClientData, ClientData));
     164static int SuffSuffIsPrefix __P((ClientData, ClientData));
     165static int SuffGNHasNameP __P((ClientData, ClientData));
     166static void SuffFree __P((ClientData));
     167static void SuffInsert __P((Lst, Suff *));
     168static void SuffRemove __P((Lst, Suff *));
     169static Boolean SuffParseTransform __P((char *, Suff **, Suff **));
     170static int SuffRebuildGraph __P((ClientData, ClientData));
     171static int SuffAddSrc __P((ClientData, ClientData));
     172static int SuffRemoveSrc __P((Lst));
     173static void SuffAddLevel __P((Lst, Src *));
     174static Src *SuffFindThem __P((Lst, Lst));
     175static Src *SuffFindCmds __P((Src *, Lst));
     176static int SuffExpandChildren __P((ClientData, ClientData));
     177static Boolean SuffApplyTransform __P((GNode *, GNode *, Suff *, Suff *));
     178static void SuffFindDeps __P((GNode *, Lst));
     179static void SuffFindArchiveDeps __P((GNode *, Lst));
     180static void SuffFindNormalDeps __P((GNode *, Lst));
     181static int SuffPrintName __P((ClientData, ClientData));
     182static int SuffPrintSuff __P((ClientData, ClientData));
     183static int SuffPrintTrans __P((ClientData, ClientData));
    180184
    181185        /*************** Lst Predicates ****************/
     
    193197 */
    194198static char    *
    195 SuffStrIsPrefix (char *pref, char *str)
     199SuffStrIsPrefix (pref, str)
     200    register char  *pref;       /* possible prefix */
     201    register char  *str;        /* string to check */
    196202{
    197203    while (*str && *pref == *str) {
     
    218224 */
    219225static char *
    220 SuffSuffIsSuffix (Suff *s, char *str)
    221 {
    222     char           *p1;         /* Pointer into suffix name */
    223     char           *p2;         /* Pointer into string being examined */
     226SuffSuffIsSuffix (s, str)
     227    register Suff  *s;          /* possible suffix */
     228    char           *str;        /* string to examine */
     229{
     230    register char  *p1;         /* Pointer into suffix name */
     231    register char  *p2;         /* Pointer into string being examined */
    224232
    225233    p1 = s->name + s->nameLen;
     
    249257 */
    250258static int
    251 SuffSuffIsSuffixP(void *s, void *str)
     259SuffSuffIsSuffixP(s, str)
     260    ClientData   s;
     261    ClientData   str;
    252262{
    253263    return(!SuffSuffIsSuffix((Suff *) s, (char *) str));
     
    268278 */
    269279static int
    270 SuffSuffHasNameP (void *s, void *sname)
     280SuffSuffHasNameP (s, sname)
     281    ClientData    s;                /* Suffix to check */
     282    ClientData    sname;            /* Desired name */
    271283{
    272284    return (strcmp ((char *) sname, ((Suff *) s)->name));
     
    289301 */
    290302static int
    291 SuffSuffIsPrefix (void *s, void *str)
     303SuffSuffIsPrefix (s, str)
     304    ClientData   s;             /* suffix to compare */
     305    ClientData   str;   /* string to examine */
    292306{
    293307    return (SuffStrIsPrefix (((Suff *) s)->name, (char *) str) == NULL ? 1 : 0);
     
    307321 */
    308322static int
    309 SuffGNHasNameP (void *gn, void *name)
     323SuffGNHasNameP (gn, name)
     324    ClientData      gn;         /* current node we're looking at */
     325    ClientData      name;       /* name we're looking for */
    310326{
    311327    return (strcmp ((char *) name, ((GNode *) gn)->name));
     
    327343 */
    328344static void
    329 SuffFree (void *sp)
     345SuffFree (sp)
     346    ClientData sp;
    330347{
    331348    Suff           *s = (Suff *) sp;
     
    342359    Lst_Destroy (s->searchPath, Dir_Destroy);
    343360
    344     free (s->name);
    345     free (s);
     361    free ((Address)s->name);
     362    free ((Address)s);
    346363}
    347364
     
    359376 */
    360377static void
    361 SuffRemove(Lst l, Suff *s)
    362 {
    363     LstNode ln = Lst_Member(l, (void *)s);
    364     if (ln != NULL) {
     378SuffRemove(l, s)
     379    Lst l;
     380    Suff *s;
     381{
     382    LstNode ln = Lst_Member(l, (ClientData)s);
     383    if (ln != NILLNODE) {
    365384        Lst_Remove(l, ln);
    366385        s->refCount--;
     
    383402 */
    384403static void
    385 SuffInsert (Lst l, Suff *s)
     404SuffInsert (l, s)
     405    Lst           l;            /* the list where in s should be inserted */
     406    Suff          *s;           /* the suffix to insert */
    386407{
    387408    LstNode       ln;           /* current element in l we're examining */
     
    391412        return;
    392413    }
    393     while ((ln = Lst_Next (l)) != NULL) {
     414    while ((ln = Lst_Next (l)) != NILLNODE) {
    394415        s2 = (Suff *) Lst_Datum (ln);
    395416        if (s2->sNum >= s->sNum) {
     
    397418        }
    398419    }
    399     if (s2 == NULL) {
    400             DEBUGF(SUFF, ("inserting an empty list?..."));
    401     }
    402420
    403421    Lst_Close (l);
    404     DEBUGF(SUFF, ("inserting %s(%d)...", s->name, s->sNum));
    405     if (ln == NULL) {
    406         DEBUGF(SUFF, ("at end of list\n"));
    407         (void)Lst_AtEnd (l, (void *)s);
     422    if (DEBUG(SUFF)) {
     423        printf("inserting %s(%d)...", s->name, s->sNum);
     424    }
     425    if (ln == NILLNODE) {
     426        if (DEBUG(SUFF)) {
     427            printf("at end of list\n");
     428        }
     429        (void)Lst_AtEnd (l, (ClientData)s);
    408430        s->refCount++;
    409         (void)Lst_AtEnd(s->ref, (void *) l);
     431        (void)Lst_AtEnd(s->ref, (ClientData) l);
    410432    } else if (s2->sNum != s->sNum) {
    411         DEBUGF(SUFF, ("before %s(%d)\n", s2->name, s2->sNum));
    412         (void)Lst_Insert (l, ln, (void *)s);
     433        if (DEBUG(SUFF)) {
     434            printf("before %s(%d)\n", s2->name, s2->sNum);
     435        }
     436        (void)Lst_Insert (l, ln, (ClientData)s);
    413437        s->refCount++;
    414         (void)Lst_AtEnd(s->ref, (void *) l);
    415     } else {
    416         DEBUGF(SUFF, ("already there\n"));
     438        (void)Lst_AtEnd(s->ref, (ClientData) l);
     439    } else if (DEBUG(SUFF)) {
     440        printf("already there\n");
    417441    }
    418442}
     
    436460 */
    437461void
    438 Suff_ClearSuffixes (void)
     462Suff_ClearSuffixes ()
    439463{
    440464    Lst_Concat (suffClean, sufflist, LST_CONCLINK);
     
    448472     * suffNull should not have parents.
    449473     */
    450     Lst_Destroy(suffNull->children, NOFREE); 
     474    Lst_Destroy(suffNull->children, NOFREE);
    451475    suffNull->children = Lst_Init(FALSE);
    452476}
     
    466490 */
    467491static Boolean
    468 SuffParseTransform(char *str, Suff **srcPtr, Suff **targPtr)
    469 {
    470     LstNode             srcLn;      /* element in suffix list of trans source*/
    471     Suff                *src;       /* Source of transformation */
    472     LstNode             targLn;     /* element in suffix list of trans target*/
    473     char                *str2;      /* Extra pointer (maybe target suffix) */
     492SuffParseTransform(str, srcPtr, targPtr)
     493    char                *str;           /* String being parsed */
     494    Suff                **srcPtr;       /* Place to store source of trans. */
     495    Suff                **targPtr;      /* Place to store target of trans. */
     496{
     497    register LstNode    srcLn;      /* element in suffix list of trans source*/
     498    register Suff       *src;       /* Source of transformation */
     499    register LstNode    targLn;     /* element in suffix list of trans target*/
     500    register char       *str2;      /* Extra pointer (maybe target suffix) */
    474501    LstNode             singleLn;   /* element in suffix list of any suffix
    475502                                     * that exactly matches str */
     
    477504                                     * null suffix */
    478505
    479     srcLn = NULL;
    480     singleLn = NULL;
     506    srcLn = NILLNODE;
     507    singleLn = NILLNODE;
    481508
    482509    /*
     
    487514     */
    488515    for (;;) {
    489         if (srcLn == NULL) {
    490             srcLn = Lst_Find(sufflist, (void *)str, SuffSuffIsPrefix);
     516        if (srcLn == NILLNODE) {
     517            srcLn = Lst_Find(sufflist, (ClientData)str, SuffSuffIsPrefix);
    491518        } else {
    492             srcLn = Lst_FindFrom (sufflist, Lst_Succ(srcLn), (void *)str,
     519            srcLn = Lst_FindFrom (sufflist, Lst_Succ(srcLn), (ClientData)str,
    493520                                  SuffSuffIsPrefix);
    494521        }
    495         if (srcLn == NULL) {
     522        if (srcLn == NILLNODE) {
    496523            /*
    497524             * Ran out of source suffixes -- no such rule
    498525             */
    499             if (singleLn != NULL) {
     526            if (singleLn != NILLNODE) {
    500527                /*
    501528                 * Not so fast Mr. Smith! There was a suffix that encompassed
     
    519546            singleLn = srcLn;
    520547        } else {
    521             targLn = Lst_Find(sufflist, (void *)str2, SuffSuffHasNameP);
    522             if (targLn != NULL) {
     548            targLn = Lst_Find(sufflist, (ClientData)str2, SuffSuffHasNameP);
     549            if (targLn != NILLNODE) {
    523550                *srcPtr = src;
    524551                *targPtr = (Suff *)Lst_Datum(targLn);
     
    544571 */
    545572Boolean
    546 Suff_IsTransform (char *str)
     573Suff_IsTransform (str)
     574    char          *str;         /* string to check */
    547575{
    548576    Suff          *src, *targ;
     
    566594 */
    567595GNode *
    568 Suff_AddTransform (char *line)
     596Suff_AddTransform (line)
     597    char          *line;        /* name of transformation to add */
    569598{
    570599    GNode         *gn;          /* GNode of transformation rule */
     
    573602    LstNode       ln;           /* Node for existing transformation */
    574603
    575     ln = Lst_Find (transforms, (void *)line, SuffGNHasNameP);
    576     if (ln == NULL) {
     604    ln = Lst_Find (transforms, (ClientData)line, SuffGNHasNameP);
     605    if (ln == NILLNODE) {
    577606        /*
    578607         * Make a new graph node for the transformation. It will be filled in
     
    580609         */
    581610        gn = Targ_NewGN (line);
    582         (void)Lst_AtEnd (transforms, (void *)gn);
     611        (void)Lst_AtEnd (transforms, (ClientData)gn);
    583612    } else {
    584613        /*
     
    602631     * link the two together in the proper relationship and order
    603632     */
    604     DEBUGF(SUFF, ("defining transformation from `%s' to `%s'\n",
    605            s->name, t->name));
     633    if (DEBUG(SUFF)) {
     634        printf("defining transformation from `%s' to `%s'\n",
     635                s->name, t->name);
     636    }
    606637    SuffInsert (t->children, s);
    607638    SuffInsert (s->parents, t);
     
    628659 */
    629660int
    630 Suff_EndTransform(void *gnp, void *dummy __unused)
     661Suff_EndTransform(gnp, dummy)
     662    ClientData   gnp;           /* Node for transformation */
     663    ClientData   dummy;         /* Node for transformation */
    631664{
    632665    GNode *gn = (GNode *) gnp;
     
    639672        (void)SuffParseTransform(gn->name, &s, &t);
    640673
    641         DEBUGF(SUFF, ("deleting transformation from `%s' to `%s'\n",
    642                s->name, t->name));
     674        if (DEBUG(SUFF)) {
     675            printf("deleting transformation from `%s' to `%s'\n",
     676                    s->name, t->name);
     677        }
    643678
    644679        /*
    645680         * Remove the source from the target's children list. We check for a
    646          * NULL return to handle a beanhead saying something like
     681         * nil return to handle a beanhead saying something like
    647682         *  .c.o .c.o:
    648683         *
     
    656691         */
    657692        SuffRemove(s->parents, t);
    658     } else if (gn->type & OP_TRANSFORM) {
    659         DEBUGF(SUFF, ("transformation %s complete\n", gn->name));
    660     }
    661 
    662     return (0);
     693    } else if ((gn->type & OP_TRANSFORM) && DEBUG(SUFF)) {
     694        printf("transformation %s complete\n", gn->name);
     695    }
     696
     697    return(dummy ? 0 : 0);
    663698}
    664699
     
    683718 */
    684719static int
    685 SuffRebuildGraph(void *transformp, void *sp)
     720SuffRebuildGraph(transformp, sp)
     721    ClientData  transformp; /* Transformation to test */
     722    ClientData  sp;         /* Suffix to rebuild */
    686723{
    687724    GNode       *transform = (GNode *) transformp;
     
    696733    cp = SuffStrIsPrefix(s->name, transform->name);
    697734    if (cp != (char *)NULL) {
    698         if (cp[0] == '\0')  /* null rule */
     735        if (cp[0] == '\0')  /* null rule */
    699736            s2 = suffNull;
    700737        else {
    701             ln = Lst_Find(sufflist, (void *)cp, SuffSuffHasNameP);
    702             if (ln != NULL)
    703                 s2 = (Suff *)Lst_Datum(ln);
     738            ln = Lst_Find(sufflist, (ClientData)cp, SuffSuffHasNameP);
     739            if (ln != NILLNODE)
     740                s2 = (Suff *)Lst_Datum(ln);
    704741        }
    705742        if (s2 != NULL) {
     
    723760         */
    724761        cp[1] = '\0';
    725         ln = Lst_Find(sufflist, (void *)transform->name, SuffSuffHasNameP);
     762        ln = Lst_Find(sufflist, (ClientData)transform->name, SuffSuffHasNameP);
    726763        /*
    727764         * Replace the start of the target suffix
    728765         */
    729766        cp[1] = s->name[0];
    730         if (ln != NULL) {
     767        if (ln != NILLNODE) {
    731768            /*
    732769             * Found it -- establish the proper relationship
     
    755792 */
    756793void
    757 Suff_AddSuffix (char *str)
     794Suff_AddSuffix (str)
     795    char          *str;     /* the name of the suffix to add */
    758796{
    759797    Suff          *s;       /* new suffix descriptor */
    760798    LstNode       ln;
    761799
    762     ln = Lst_Find (sufflist, (void *)str, SuffSuffHasNameP);
    763     if (ln == NULL) {
     800    ln = Lst_Find (sufflist, (ClientData)str, SuffSuffHasNameP);
     801    if (ln == NILLNODE) {
    764802        s = (Suff *) emalloc (sizeof (Suff));
    765803
     
    774812        s->refCount =   0;
    775813
    776         (void)Lst_AtEnd (sufflist, (void *)s);
     814        (void)Lst_AtEnd (sufflist, (ClientData)s);
    777815        /*
    778816         * Look for any existing transformations from or to this suffix.
    779817         * XXX: Only do this after a Suff_ClearSuffixes?
    780818         */
    781         Lst_ForEach (transforms, SuffRebuildGraph, (void *)s);
     819        Lst_ForEach (transforms, SuffRebuildGraph, (ClientData)s);
    782820    }
    783821}
     
    789827 *
    790828 * Results:
    791  *      The searchPath for the desired suffix or NULL if the suffix isn't
     829 *      The searchPath for the desired suffix or NILLST if the suffix isn't
    792830 *      defined.
    793831 *
     
    797835 */
    798836Lst
    799 Suff_GetPath (char *sname)
     837Suff_GetPath (sname)
     838    char          *sname;
    800839{
    801840    LstNode       ln;
    802841    Suff          *s;
    803842
    804     ln = Lst_Find (sufflist, (void *)sname, SuffSuffHasNameP);
    805     if (ln == NULL) {
    806         return (NULL);
     843    ln = Lst_Find (sufflist, (ClientData)sname, SuffSuffHasNameP);
     844    if (ln == NILLNODE) {
     845        return (NILLST);
    807846    } else {
    808847        s = (Suff *) Lst_Datum (ln);
     
    824863 *      directories in dirSearchPath. If paths were specified for the
    825864 *      ".h" suffix, the directories are stuffed into a global variable
    826  *      called ".INCLUDES" with each directory preceded by a -I. The same
     865 *      called ".INCLUDES" with each directory preceeded by a -I. The same
    827866 *      is done for the ".a" suffix, except the variable is called
    828867 *      ".LIBS" and the flag is -L.
     
    830869 */
    831870void
    832 Suff_DoPaths(void)
    833 {
    834     Suff                *s;
    835     LstNode             ln;
     871Suff_DoPaths()
     872{
     873    register Suff       *s;
     874    register LstNode    ln;
    836875    char                *ptr;
    837876    Lst                 inIncludes; /* Cumulative .INCLUDES path */
     
    845884    inLibs = Lst_Init(FALSE);
    846885
    847     while ((ln = Lst_Next (sufflist)) != NULL) {
     886    while ((ln = Lst_Next (sufflist)) != NILLNODE) {
    848887        s = (Suff *) Lst_Datum (ln);
    849888        if (!Lst_IsEmpty (s->searchPath)) {
     
    892931 */
    893932void
    894 Suff_AddInclude (char *sname)
     933Suff_AddInclude (sname)
     934    char          *sname;     /* Name of suffix to mark */
    895935{
    896936    LstNode       ln;
    897937    Suff          *s;
    898938
    899     ln = Lst_Find (sufflist, (void *)sname, SuffSuffHasNameP);
    900     if (ln != NULL) {
     939    ln = Lst_Find (sufflist, (ClientData)sname, SuffSuffHasNameP);
     940    if (ln != NILLNODE) {
    901941        s = (Suff *) Lst_Datum (ln);
    902942        s->flags |= SUFF_INCLUDE;
     
    921961 */
    922962void
    923 Suff_AddLib (char *sname)
     963Suff_AddLib (sname)
     964    char          *sname;     /* Name of suffix to mark */
    924965{
    925966    LstNode       ln;
    926967    Suff          *s;
    927968
    928     ln = Lst_Find (sufflist, (void *)sname, SuffSuffHasNameP);
    929     if (ln != NULL) {
     969    ln = Lst_Find (sufflist, (ClientData)sname, SuffSuffHasNameP);
     970    if (ln != NILLNODE) {
    930971        s = (Suff *) Lst_Datum (ln);
    931972        s->flags |= SUFF_LIBRARY;
     
    950991 */
    951992static int
    952 SuffAddSrc (void *sp, void *lsp)
     993SuffAddSrc (sp, lsp)
     994    ClientData  sp;         /* suffix for which to create a Src structure */
     995    ClientData  lsp;        /* list and parent for the new Src */
    953996{
    954997    Suff        *s = (Suff *) sp;
     
    9691012        s2->pref =      targ->pref;
    9701013        s2->parent =    targ;
    971         s2->node =      NULL;
     1014        s2->node =      NILGNODE;
    9721015        s2->suff =      s;
    9731016        s->refCount++;
    9741017        s2->children =  0;
    9751018        targ->children += 1;
    976         (void)Lst_AtEnd (ls->l, (void *)s2);
     1019        (void)Lst_AtEnd (ls->l, (ClientData)s2);
    9771020#ifdef DEBUG_SRC
    9781021        s2->cp = Lst_Init(FALSE);
    979         Lst_AtEnd(targ->cp, (void *) s2);
     1022        Lst_AtEnd(targ->cp, (ClientData) s2);
    9801023        printf("1 add %x %x to %x:", targ, s2, ls->l);
    981         Lst_ForEach(ls->l, PrintAddr, (void *) 0);
     1024        Lst_ForEach(ls->l, PrintAddr, (ClientData) 0);
    9821025        printf("\n");
    9831026#endif
     
    9871030    s2->pref =      targ->pref;
    9881031    s2->parent =    targ;
    989     s2->node =      NULL;
     1032    s2->node =      NILGNODE;
    9901033    s2->suff =      s;
    9911034    s->refCount++;
    9921035    s2->children =  0;
    9931036    targ->children += 1;
    994     (void)Lst_AtEnd (ls->l, (void *)s2);
     1037    (void)Lst_AtEnd (ls->l, (ClientData)s2);
    9951038#ifdef DEBUG_SRC
    9961039    s2->cp = Lst_Init(FALSE);
    997     Lst_AtEnd(targ->cp, (void *) s2);
     1040    Lst_AtEnd(targ->cp, (ClientData) s2);
    9981041    printf("2 add %x %x to %x:", targ, s2, ls->l);
    999     Lst_ForEach(ls->l, PrintAddr, (void *) 0);
     1042    Lst_ForEach(ls->l, PrintAddr, (ClientData) 0);
    10001043    printf("\n");
    10011044#endif
     
    10171060 */
    10181061static void
    1019 SuffAddLevel (Lst l, Src *targ)
     1062SuffAddLevel (l, targ)
     1063    Lst            l;           /* list to which to add the new level */
     1064    Src            *targ;       /* Src structure to use as the parent */
    10201065{
    10211066    LstSrc         ls;
     
    10241069    ls.l = l;
    10251070
    1026     Lst_ForEach (targ->suff->children, SuffAddSrc, (void *)&ls);
     1071    Lst_ForEach (targ->suff->children, SuffAddSrc, (ClientData)&ls);
    10271072}
    10281073
     
    10401085 */
    10411086static int
    1042 SuffRemoveSrc (Lst l)
     1087SuffRemoveSrc (l)
     1088    Lst l;
    10431089{
    10441090    LstNode ln;
     
    10511097#ifdef DEBUG_SRC
    10521098    printf("cleaning %lx: ", (unsigned long) l);
    1053     Lst_ForEach(l, PrintAddr, (void *) 0);
     1099    Lst_ForEach(l, PrintAddr, (ClientData) 0);
    10541100    printf("\n");
    10551101#endif
    10561102
    10571103
    1058     while ((ln = Lst_Next (l)) != NULL) {
     1104    while ((ln = Lst_Next (l)) != NILLNODE) {
    10591105        s = (Src *) Lst_Datum (ln);
    10601106        if (s->children == 0) {
    1061             free (s->file);
     1107            free ((Address)s->file);
    10621108            if (!s->parent)
    1063                 free(s->pref);
     1109                free((Address)s->pref);
    10641110            else {
    10651111#ifdef DEBUG_SRC
    1066                 LstNode ln = Lst_Member(s->parent->cp, (void *)s);
    1067                 if (ln != NULL)
     1112                LstNode ln = Lst_Member(s->parent->cp, (ClientData)s);
     1113                if (ln != NILLNODE)
    10681114                    Lst_Remove(s->parent->cp, ln);
    10691115#endif
     
    10751121#endif
    10761122            Lst_Remove(l, ln);
    1077             free (s);
     1123            free ((Address)s);
    10781124            t |= 1;
    10791125            Lst_Close(l);
     
    10831129        else {
    10841130            printf("keep: [l=%x] p=%x %d: ", l, s, s->children);
    1085             Lst_ForEach(s->cp, PrintAddr, (void *) 0);
     1131            Lst_ForEach(s->cp, PrintAddr, (ClientData) 0);
    10861132            printf("\n");
    10871133        }
     
    11071153 */
    11081154static Src *
    1109 SuffFindThem (Lst srcs, Lst slst)
     1155SuffFindThem (srcs, slst)
     1156    Lst            srcs;        /* list of Src structures to search through */
     1157    Lst            slst;
    11101158{
    11111159    Src            *s;          /* current Src */
     
    11181166        s = (Src *) Lst_DeQueue (srcs);
    11191167
    1120         DEBUGF(SUFF, ("\ttrying %s...", s->file));
     1168        if (DEBUG(SUFF)) {
     1169            printf ("\ttrying %s...", s->file);
     1170        }
    11211171
    11221172        /*
     
    11241174         * graph for it or the file actually exists.
    11251175         */
    1126         if (Targ_FindNode(s->file, TARG_NOCREATE) != NULL) {
     1176        if (Targ_FindNode(s->file, TARG_NOCREATE) != NILGNODE) {
    11271177#ifdef DEBUG_SRC
    11281178            printf("remove %x from %x\n", s, srcs);
     
    11411191        }
    11421192
    1143         DEBUGF(SUFF, ("not there\n"));
     1193        if (DEBUG(SUFF)) {
     1194            printf ("not there\n");
     1195        }
    11441196
    11451197        SuffAddLevel (srcs, s);
    1146         Lst_AtEnd(slst, (void *) s);
    1147     }
    1148 
    1149     if (rs) {
    1150         DEBUGF(SUFF, ("got it\n"));
     1198        Lst_AtEnd(slst, (ClientData) s);
     1199    }
     1200
     1201    if (DEBUG(SUFF) && rs) {
     1202        printf ("got it\n");
    11511203    }
    11521204    return (rs);
     
    11611213 *
    11621214 * Results:
    1163  *      The Src structure of the "winning" child, or NULL if no such beast.
     1215 *      The Src structure of the "winning" child, or NIL if no such beast.
    11641216 *
    11651217 * Side Effects:
     
    11691221 */
    11701222static Src *
    1171 SuffFindCmds (Src *targ, Lst slst)
     1223SuffFindCmds (targ, slst)
     1224    Src         *targ;  /* Src structure to play with */
     1225    Lst         slst;
    11721226{
    11731227    LstNode             ln;     /* General-purpose list node */
    1174     GNode               *t,     /* Target GNode */
     1228    register GNode      *t,     /* Target GNode */
    11751229                        *s;     /* Source GNode */
    11761230    int                 prefLen;/* The length of the defined prefix */
     
    11831237    prefLen = strlen (targ->pref);
    11841238
    1185     while ((ln = Lst_Next (t->children)) != NULL) {
     1239    while ((ln = Lst_Next (t->children)) != NILLNODE) {
    11861240        s = (GNode *)Lst_Datum (ln);
    11871241
     
    11971251             * suffix.
    11981252             */
    1199             ln = Lst_Find (sufflist, (void *)&cp[prefLen],
     1253            ln = Lst_Find (sufflist, (ClientData)&cp[prefLen],
    12001254                           SuffSuffHasNameP);
    1201             if (ln != NULL) {
     1255            if (ln != NILLNODE) {
    12021256                /*
    12031257                 * It even has a known suffix, see if there's a transformation
     
    12091263
    12101264                if (Lst_Member (suff->parents,
    1211                                 (void *)targ->suff) != NULL)
     1265                                (ClientData)targ->suff) != NILLNODE)
    12121266                {
    12131267                    /*
     
    12291283                    ret->cp = Lst_Init(FALSE);
    12301284                    printf("3 add %x %x\n", targ, ret);
    1231                     Lst_AtEnd(targ->cp, (void *) ret);
     1285                    Lst_AtEnd(targ->cp, (ClientData) ret);
    12321286#endif
    1233                     Lst_AtEnd(slst, (void *) ret);
    1234                     DEBUGF(SUFF, ("\tusing existing source %s\n", s->name));
     1287                    Lst_AtEnd(slst, (ClientData) ret);
     1288                    if (DEBUG(SUFF)) {
     1289                        printf ("\tusing existing source %s\n", s->name);
     1290                    }
    12351291                    return (ret);
    12361292                }
     
    12591315 */
    12601316static int
    1261 SuffExpandChildren(void *cgnp, void *pgnp)
     1317SuffExpandChildren(cgnp, pgnp)
     1318    ClientData  cgnp;       /* Child to examine */
     1319    ClientData  pgnp;       /* Parent node being processed */
    12621320{
    12631321    GNode       *cgn = (GNode *) cgnp;
     
    12721330     * after the child
    12731331     */
    1274     prevLN = Lst_Member(pgn->children, (void *)cgn);
     1332    prevLN = Lst_Member(pgn->children, (ClientData)cgn);
    12751333
    12761334    /*
     
    12811339     */
    12821340    if (strchr(cgn->name, '$') != (char *)NULL) {
    1283         DEBUGF(SUFF, ("Expanding \"%s\"...", cgn->name));
     1341        if (DEBUG(SUFF)) {
     1342            printf("Expanding \"%s\"...", cgn->name);
     1343        }
    12841344        cp = Var_Subst(NULL, cgn->name, pgn, TRUE);
    12851345
     
    13171377                        *cp++ = '\0';
    13181378                        gn = Targ_FindNode(start, TARG_CREATE);
    1319                         (void)Lst_AtEnd(members, (void *)gn);
     1379                        (void)Lst_AtEnd(members, (ClientData)gn);
    13201380                        while (*cp == ' ' || *cp == '\t') {
    13211381                            cp++;
     
    13561416                     */
    13571417                    gn = Targ_FindNode(start, TARG_CREATE);
    1358                     (void)Lst_AtEnd(members, (void *)gn);
     1418                    (void)Lst_AtEnd(members, (ClientData)gn);
    13591419                }
    13601420                /*
     
    13701430                gn = (GNode *)Lst_DeQueue(members);
    13711431
    1372                 DEBUGF(SUFF, ("%s...", gn->name));
    1373                 if (Lst_Member(pgn->children, (void *)gn) == NULL) {
    1374                     (void)Lst_Append(pgn->children, prevLN, (void *)gn);
     1432                if (DEBUG(SUFF)) {
     1433                    printf("%s...", gn->name);
     1434                }
     1435                if (Lst_Member(pgn->children, (ClientData)gn) == NILLNODE) {
     1436                    (void)Lst_Append(pgn->children, prevLN, (ClientData)gn);
    13751437                    prevLN = Lst_Succ(prevLN);
    1376                     (void)Lst_AtEnd(gn->parents, (void *)pgn);
     1438                    (void)Lst_AtEnd(gn->parents, (ClientData)pgn);
    13771439                    pgn->unmade++;
    13781440                }
     
    13881450         * keep it from being processed.
    13891451         */
    1390         ln = Lst_Member(pgn->children, (void *)cgn);
     1452        ln = Lst_Member(pgn->children, (ClientData)cgn);
    13911453        pgn->unmade--;
    13921454        Lst_Remove(pgn->children, ln);
    1393         DEBUGF(SUFF, ("\n"));
     1455        if (DEBUG(SUFF)) {
     1456            printf("\n");
     1457        }
    13941458    } else if (Dir_HasWildcards(cgn->name)) {
    13951459        Lst     exp;        /* List of expansions */
     
    14051469         */
    14061470        cp = cgn->name + strlen(cgn->name);
    1407         ln = Lst_Find(sufflist, (void *)cp, SuffSuffIsSuffixP);
    1408 
    1409         DEBUGF(SUFF, ("Wildcard expanding \"%s\"...", cgn->name));
    1410 
    1411         if (ln != NULL) {
     1471        ln = Lst_Find(sufflist, (ClientData)cp, SuffSuffIsSuffixP);
     1472
     1473        if (DEBUG(SUFF)) {
     1474            printf("Wildcard expanding \"%s\"...", cgn->name);
     1475        }
     1476
     1477        if (ln != NILLNODE) {
    14121478            Suff    *s = (Suff *)Lst_Datum(ln);
    14131479
    1414             DEBUGF(SUFF, ("suffix is \"%s\"...", s->name));
     1480            if (DEBUG(SUFF)) {
     1481                printf("suffix is \"%s\"...", s->name);
     1482            }
    14151483            path = s->searchPath;
    14161484        } else {
     
    14331501            cp = (char *)Lst_DeQueue(exp);
    14341502
    1435             DEBUGF(SUFF, ("%s...", cp));
     1503            if (DEBUG(SUFF)) {
     1504                printf("%s...", cp);
     1505            }
    14361506            gn = Targ_FindNode(cp, TARG_CREATE);
    14371507
     
    14401510             * up the parent's count of unmade children.
    14411511             */
    1442             if (Lst_Member(pgn->children, (void *)gn) == NULL) {
    1443                 (void)Lst_Append(pgn->children, prevLN, (void *)gn);
     1512            if (Lst_Member(pgn->children, (ClientData)gn) == NILLNODE) {
     1513                (void)Lst_Append(pgn->children, prevLN, (ClientData)gn);
    14441514                prevLN = Lst_Succ(prevLN);
    1445                 (void)Lst_AtEnd(gn->parents, (void *)pgn);
     1515                (void)Lst_AtEnd(gn->parents, (ClientData)pgn);
    14461516                pgn->unmade++;
    14471517            }
     
    14571527         * keep it from being processed.
    14581528         */
    1459         ln = Lst_Member(pgn->children, (void *)cgn);
     1529        ln = Lst_Member(pgn->children, (ClientData)cgn);
    14601530        pgn->unmade--;
    14611531        Lst_Remove(pgn->children, ln);
    1462         DEBUGF(SUFF, ("\n"));
     1532        if (DEBUG(SUFF)) {
     1533            printf("\n");
     1534        }
    14631535    }
    14641536
     
    14851557 */
    14861558static Boolean
    1487 SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s)
     1559SuffApplyTransform(tGn, sGn, t, s)
     1560    GNode       *tGn;       /* Target node */
     1561    GNode       *sGn;       /* Source node */
     1562    Suff        *t;         /* Target suffix */
     1563    Suff        *s;         /* Source suffix */
    14881564{
    14891565    LstNode     ln;         /* General node */
     
    14911567    GNode       *gn;        /* Node for same */
    14921568
    1493     if (Lst_Member(tGn->children, (void *)sGn) == NULL) {
     1569    if (Lst_Member(tGn->children, (ClientData)sGn) == NILLNODE) {
    14941570        /*
    14951571         * Not already linked, so form the proper links between the
    14961572         * target and source.
    14971573         */
    1498         (void)Lst_AtEnd(tGn->children, (void *)sGn);
    1499         (void)Lst_AtEnd(sGn->parents, (void *)tGn);
     1574        (void)Lst_AtEnd(tGn->children, (ClientData)sGn);
     1575        (void)Lst_AtEnd(sGn->parents, (ClientData)tGn);
    15001576        tGn->unmade += 1;
    15011577    }
     
    15081584         * will be sufficient to get the .IMPSRC variable set for tGn
    15091585         */
    1510         for (ln=Lst_First(sGn->cohorts); ln != NULL; ln=Lst_Succ(ln)) {
     1586        for (ln=Lst_First(sGn->cohorts); ln != NILLNODE; ln=Lst_Succ(ln)) {
    15111587            gn = (GNode *)Lst_Datum(ln);
    15121588
    1513             if (Lst_Member(tGn->children, (void *)gn) == NULL) {
     1589            if (Lst_Member(tGn->children, (ClientData)gn) == NILLNODE) {
    15141590                /*
    15151591                 * Not already linked, so form the proper links between the
    15161592                 * target and source.
    15171593                 */
    1518                 (void)Lst_AtEnd(tGn->children, (void *)gn);
    1519                 (void)Lst_AtEnd(gn->parents, (void *)tGn);
     1594                (void)Lst_AtEnd(tGn->children, (ClientData)gn);
     1595                (void)Lst_AtEnd(gn->parents, (ClientData)tGn);
    15201596                tGn->unmade += 1;
    15211597            }
     
    15261602     */
    15271603    tname = str_concat(s->name, t->name, 0);
    1528     ln = Lst_Find(transforms, (void *)tname, SuffGNHasNameP);
     1604    ln = Lst_Find(transforms, (ClientData)tname, SuffGNHasNameP);
    15291605    free(tname);
    15301606
    1531     if (ln == NULL) {
     1607    if (ln == NILLNODE) {
    15321608        /*
    15331609         * Not really such a transformation rule (can happen when we're
     
    15401616    gn = (GNode *)Lst_Datum(ln);
    15411617
    1542     DEBUGF(SUFF, ("\tapplying %s -> %s to \"%s\"\n", s->name, t->name, tGn->name));
     1618    if (DEBUG(SUFF)) {
     1619        printf("\tapplying %s -> %s to \"%s\"\n", s->name, t->name, tGn->name);
     1620    }
    15431621
    15441622    /*
     
    15561634     */
    15571635    ln = Lst_Succ(ln);
    1558     if (ln != NULL) {
     1636    if (ln != NILLNODE) {
    15591637        Lst_ForEachFrom(tGn->children, ln,
    1560                         SuffExpandChildren, (void *)tGn);
     1638                        SuffExpandChildren, (ClientData)tGn);
    15611639    }
    15621640
     
    15651643     * the .IMPSRC variable can be set correctly for the parent.
    15661644     */
    1567     (void)Lst_AtEnd(sGn->iParents, (void *)tGn);
     1645    (void)Lst_AtEnd(sGn->iParents, (ClientData)tGn);
    15681646
    15691647    return(TRUE);
     
    15851663 */
    15861664static void
    1587 SuffFindArchiveDeps(GNode *gn, Lst slst)
     1665SuffFindArchiveDeps(gn, slst)
     1666    GNode       *gn;        /* Node for which to locate dependencies */
     1667    Lst         slst;
    15881668{
    15891669    char        *eoarch;    /* End of archive portion */
     
    16231703     * Create the link between the two nodes right off
    16241704     */
    1625     if (Lst_Member(gn->children, (void *)mem) == NULL) {
    1626         (void)Lst_AtEnd(gn->children, (void *)mem);
    1627         (void)Lst_AtEnd(mem->parents, (void *)gn);
     1705    if (Lst_Member(gn->children, (ClientData)mem) == NILLNODE) {
     1706        (void)Lst_AtEnd(gn->children, (ClientData)mem);
     1707        (void)Lst_AtEnd(mem->parents, (ClientData)gn);
    16281708        gn->unmade += 1;
    16291709    }
     
    16441724         * Didn't know what it was -- use .NULL suffix if not in make mode
    16451725         */
    1646         DEBUGF(SUFF, ("using null suffix\n"));
     1726        if (DEBUG(SUFF)) {
     1727            printf("using null suffix\n");
     1728        }
    16471729        ms = suffNull;
    16481730    }
     
    16691751        ln = Lst_Find(ms->parents, eoarch, SuffSuffIsSuffixP);
    16701752
    1671         if (ln != NULL) {
     1753        if (ln != NILLNODE) {
    16721754            /*
    16731755             * Got one -- apply it
    16741756             */
    1675             if (!SuffApplyTransform(gn, mem, (Suff *)Lst_Datum(ln), ms)) {
    1676                 DEBUGF(SUFF, ("\tNo transformation from %s -> %s\n",
    1677                        ms->name, ((Suff *)Lst_Datum(ln))->name));
     1757            if (!SuffApplyTransform(gn, mem, (Suff *)Lst_Datum(ln), ms) &&
     1758                DEBUG(SUFF))
     1759            {
     1760                printf("\tNo transformation from %s -> %s\n",
     1761                       ms->name, ((Suff *)Lst_Datum(ln))->name);
    16781762            }
    16791763        }
     
    17161800 */
    17171801static void
    1718 SuffFindNormalDeps(GNode *gn, Lst slst)
     1802SuffFindNormalDeps(gn, slst)
     1803    GNode       *gn;        /* Node for which to find sources */
     1804    Lst         slst;
    17191805{
    17201806    char        *eoname;    /* End of name */
     
    17611847     */
    17621848
    1763     while (ln != NULL) {
     1849    while (ln != NILLNODE) {
    17641850        /*
    17651851         * Look for next possible suffix...
     
    17671853        ln = Lst_FindFrom(sufflist, ln, eoname, SuffSuffIsSuffixP);
    17681854
    1769         if (ln != NULL) {
     1855        if (ln != NILLNODE) {
    17701856            int     prefLen;        /* Length of the prefix */
    1771             Src     *target;
     1857            Src     *targ;
    17721858
    17731859            /*
    17741860             * Allocate a Src structure to which things can be transformed
    17751861             */
    1776             target = (Src *)emalloc(sizeof (Src));
    1777             target->file = estrdup(gn->name);
    1778             target->suff = (Suff *)Lst_Datum(ln);
    1779             target->suff->refCount++;
    1780             target->node = gn;
    1781             target->parent = (Src *)NULL;
    1782             target->children = 0;
     1862            targ = (Src *)emalloc(sizeof (Src));
     1863            targ->file = estrdup(gn->name);
     1864            targ->suff = (Suff *)Lst_Datum(ln);
     1865            targ->suff->refCount++;
     1866            targ->node = gn;
     1867            targ->parent = (Src *)NULL;
     1868            targ->children = 0;
    17831869#ifdef DEBUG_SRC
    1784             target->cp = Lst_Init(FALSE);
     1870            targ->cp = Lst_Init(FALSE);
    17851871#endif
    17861872
     
    17891875             * the length of the suffix from the end of the name.
    17901876             */
    1791             prefLen = (eoname - target->suff->nameLen) - sopref;
    1792             target->pref = emalloc(prefLen + 1);
    1793             memcpy(target->pref, sopref, prefLen);
    1794             target->pref[prefLen] = '\0';
     1877            prefLen = (eoname - targ->suff->nameLen) - sopref;
     1878            targ->pref = emalloc(prefLen + 1);
     1879            memcpy(targ->pref, sopref, prefLen);
     1880            targ->pref[prefLen] = '\0';
    17951881
    17961882            /*
    17971883             * Add nodes from which the target can be made
    17981884             */
    1799             SuffAddLevel(srcs, target);
     1885            SuffAddLevel(srcs, targ);
    18001886
    18011887            /*
    18021888             * Record the target so we can nuke it
    18031889             */
    1804             (void)Lst_AtEnd(targs, (void *)target);
     1890            (void)Lst_AtEnd(targs, (ClientData)targ);
    18051891
    18061892            /*
     
    18151901     */
    18161902    if (Lst_IsEmpty(targs) && suffNull != NULL) {
    1817         DEBUGF(SUFF, ("\tNo known suffix on %s. Using .NULL suffix\n", gn->name));
     1903        if (DEBUG(SUFF)) {
     1904            printf("\tNo known suffix on %s. Using .NULL suffix\n", gn->name);
     1905        }
    18181906
    18191907        targ = (Src *)emalloc(sizeof (Src));
     
    18361924            SuffAddLevel(srcs, targ);
    18371925        else {
    1838             DEBUGF(SUFF, ("not "));
    1839         }
    1840 
    1841         DEBUGF(SUFF, ("adding suffix rules\n"));
    1842 
    1843         (void)Lst_AtEnd(targs, (void *)targ);
     1926            if (DEBUG(SUFF))
     1927                printf("not ");
     1928        }
     1929
     1930        if (DEBUG(SUFF))
     1931            printf("adding suffix rules\n");
     1932
     1933        (void)Lst_AtEnd(targs, (ClientData)targ);
    18441934    }
    18451935
     
    18841974     * that still contain variables or wildcards in their names.
    18851975     */
    1886     Lst_ForEach(gn->children, SuffExpandChildren, (void *)gn);
     1976    Lst_ForEach(gn->children, SuffExpandChildren, (ClientData)gn);
    18871977
    18881978    if (targ == NULL) {
    1889         DEBUGF(SUFF, ("\tNo valid suffix on %s\n", gn->name));
     1979        if (DEBUG(SUFF)) {
     1980            printf("\tNo valid suffix on %s\n", gn->name);
     1981        }
    18901982
    18911983sfnd_abort:
     
    19842076             */
    19852077            while (bottom && bottom->parent != NULL) {
    1986                 if (Lst_Member(slst, (void *) bottom) == NULL) {
    1987                     Lst_AtEnd(slst, (void *) bottom);
     2078                if (Lst_Member(slst, (ClientData) bottom) == NILLNODE) {
     2079                    Lst_AtEnd(slst, (ClientData) bottom);
    19882080                }
    19892081                bottom = bottom->parent;
     
    20122104     * Etc.
    20132105     */
    2014     if (bottom->node == NULL) {
     2106    if (bottom->node == NILGNODE) {
    20152107        bottom->node = Targ_FindNode(bottom->file, TARG_CREATE);
    20162108    }
     
    20242116        src->node->suffix->refCount++;
    20252117
    2026         if (targ->node == NULL) {
     2118        if (targ->node == NILGNODE) {
    20272119            targ->node = Targ_FindNode(targ->file, TARG_CREATE);
    20282120        }
     
    20662158sfnd_return:
    20672159    if (bottom)
    2068         if (Lst_Member(slst, (void *) bottom) == NULL)
    2069             Lst_AtEnd(slst, (void *) bottom);
     2160        if (Lst_Member(slst, (ClientData) bottom) == NILLNODE)
     2161            Lst_AtEnd(slst, (ClientData) bottom);
    20702162
    20712163    while (SuffRemoveSrc(srcs) || SuffRemoveSrc(targs))
     
    21062198
    21072199void
    2108 Suff_FindDeps(GNode *gn)
     2200Suff_FindDeps(gn)
     2201    GNode *gn;
    21092202{
    21102203
     
    21162209
    21172210static void
    2118 SuffFindDeps (GNode *gn, Lst slst)
     2211SuffFindDeps (gn, slst)
     2212    GNode         *gn;          /* node we're dealing with */
     2213    Lst           slst;
    21192214{
    21202215    if (gn->type & OP_DEPS_FOUND) {
     
    21272222    }
    21282223
    2129     DEBUGF(SUFF, ("SuffFindDeps (%s)\n", gn->name));
     2224    if (DEBUG(SUFF)) {
     2225        printf ("SuffFindDeps (%s)\n", gn->name);
     2226    }
    21302227
    21312228    if (gn->type & OP_ARCHV) {
     
    21432240        Suff    *s;
    21442241
    2145         ln = Lst_Find (sufflist, (void *)LIBSUFF, SuffSuffHasNameP);
     2242        ln = Lst_Find (sufflist, (ClientData)LIBSUFF, SuffSuffHasNameP);
    21462243        if (gn->suffix)
    21472244            gn->suffix->refCount--;
    2148         if (ln != NULL) {
     2245        if (ln != NILLNODE) {
    21492246            gn->suffix = s = (Suff *) Lst_Datum (ln);
    21502247            gn->suffix->refCount++;
     
    21832280 */
    21842281void
    2185 Suff_SetNull(char *name)
     2282Suff_SetNull(name)
     2283    char    *name;          /* Name of null suffix */
    21862284{
    21872285    Suff    *s;
    21882286    LstNode ln;
    21892287
    2190     ln = Lst_Find(sufflist, (void *)name, SuffSuffHasNameP);
    2191     if (ln != NULL) {
     2288    ln = Lst_Find(sufflist, (ClientData)name, SuffSuffHasNameP);
     2289    if (ln != NILLNODE) {
    21922290        s = (Suff *)Lst_Datum(ln);
    21932291        if (suffNull != (Suff *)NULL) {
     
    22182316 */
    22192317void
    2220 Suff_Init (void)
     2318Suff_Init ()
    22212319{
    22222320    sufflist = Lst_Init (FALSE);
     
    22612359
    22622360void
    2263 Suff_End(void)
     2361Suff_End()
    22642362{
    22652363    Lst_Destroy(sufflist, SuffFree);
     
    22742372/********************* DEBUGGING FUNCTIONS **********************/
    22752373
     2374static int SuffPrintName(s, dummy)
     2375    ClientData s;
     2376    ClientData dummy;
     2377{
     2378    printf ("`%s' ", ((Suff *) s)->name);
     2379    return (dummy ? 0 : 0);
     2380}
     2381
    22762382static int
    2277 SuffPrintName(void *s, void *dummy __unused)
    2278 {
    2279     printf ("`%s' ", ((Suff *) s)->name);
    2280     return (0);
    2281 }
    2282 
    2283 static int
    2284 SuffPrintSuff (void *sp, void *dummy __unused)
     2383SuffPrintSuff (sp, dummy)
     2384    ClientData sp;
     2385    ClientData dummy;
    22852386{
    22862387    Suff    *s = (Suff *) sp;
     
    23062407                    printf ("LIBRARY");
    23072408                    break;
    2308                 default:
    2309                     break;
    23102409            }
    23112410            fputc(flags ? '|' : ')', stdout);
     
    23142413    fputc ('\n', stdout);
    23152414    printf ("#\tTo: ");
    2316     Lst_ForEach (s->parents, SuffPrintName, (void *)0);
     2415    Lst_ForEach (s->parents, SuffPrintName, (ClientData)0);
    23172416    fputc ('\n', stdout);
    23182417    printf ("#\tFrom: ");
    2319     Lst_ForEach (s->children, SuffPrintName, (void *)0);
     2418    Lst_ForEach (s->children, SuffPrintName, (ClientData)0);
    23202419    fputc ('\n', stdout);
    23212420    printf ("#\tSearch Path: ");
    23222421    Dir_PrintPath (s->searchPath);
    23232422    fputc ('\n', stdout);
    2324     return (0);
     2423    return (dummy ? 0 : 0);
    23252424}
    23262425
    23272426static int
    2328 SuffPrintTrans (void *tp, void *dummy __unused)
     2427SuffPrintTrans (tp, dummy)
     2428    ClientData tp;
     2429    ClientData dummy;
    23292430{
    23302431    GNode   *t = (GNode *) tp;
     
    23332434    Targ_PrintType (t->type);
    23342435    fputc ('\n', stdout);
    2335     Lst_ForEach (t->commands, Targ_PrintCmd, (void *)0);
     2436    Lst_ForEach (t->commands, Targ_PrintCmd, (ClientData)0);
    23362437    fputc ('\n', stdout);
    2337     return (0);
     2438    return(dummy ? 0 : 0);
    23382439}
    23392440
    23402441void
    2341 Suff_PrintAll(void)
     2442Suff_PrintAll()
    23422443{
    23432444    printf ("#*** Suffixes:\n");
    2344     Lst_ForEach (sufflist, SuffPrintSuff, (void *)0);
     2445    Lst_ForEach (sufflist, SuffPrintSuff, (ClientData)0);
    23452446
    23462447    printf ("#*** Transformations:\n");
    2347     Lst_ForEach (transforms, SuffPrintTrans, (void *)0);
    2348 }
     2448    Lst_ForEach (transforms, SuffPrintTrans, (ClientData)0);
     2449}
Note: See TracChangeset for help on using the changeset viewer.