=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/arch.c,v retrieving revision 1.9 retrieving revision 1.10 diff -c -r1.9 -r1.10 *** src/usr.bin/make/arch.c 1996/11/30 21:08:49 1.9 --- src/usr.bin/make/arch.c 1997/06/17 20:34:43 1.10 *************** *** 1,4 **** ! /* $OpenBSD: arch.c,v 1.9 1996/11/30 21:08:49 millert Exp $ */ /* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: arch.c,v 1.10 1997/06/17 20:34:43 kstailey Exp $ */ /* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */ /* *************** *** 43,49 **** #if 0 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else ! static char rcsid[] = "$OpenBSD: arch.c,v 1.9 1996/11/30 21:08:49 millert Exp $"; #endif #endif /* not lint */ --- 43,49 ---- #if 0 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else ! static char rcsid[] = "$OpenBSD: arch.c,v 1.10 1997/06/17 20:34:43 kstailey Exp $"; #endif #endif /* not lint */ *************** *** 153,159 **** /* Free memory from hash entries */ for (entry = Hash_EnumFirst(&a->members, &search); ! entry != (Hash_Entry *)NULL; entry = Hash_EnumNext(&search)) free((Address) Hash_GetValue (entry)); --- 153,159 ---- /* Free memory from hash entries */ for (entry = Hash_EnumFirst(&a->members, &search); ! entry != NULL; entry = Hash_EnumNext(&search)) free((Address) Hash_GetValue (entry)); *************** *** 481,489 **** * the comparisons easier... */ cp = strrchr (member, '/'); ! if (cp != (char *) NULL) { member = cp + 1; - } ln = Lst_Find (archives, (ClientData) archive, ArchFindArchive); if (ln != NILLNODE) { --- 481,488 ---- * the comparisons easier... */ cp = strrchr (member, '/'); ! if (cp != NULL) member = cp + 1; ln = Lst_Find (archives, (ClientData) archive, ArchFindArchive); if (ln != NILLNODE) { *************** *** 491,497 **** he = Hash_FindEntry (&ar->members, member); ! if (he != (Hash_Entry *) NULL) { return ((struct ar_hdr *) Hash_GetValue (he)); } else { /* Try truncated name */ --- 490,496 ---- he = Hash_FindEntry (&ar->members, member); ! if (he != NULL) { return ((struct ar_hdr *) Hash_GetValue (he)); } else { /* Try truncated name */ *************** *** 505,511 **** } if ((he = Hash_FindEntry (&ar->members, copy)) != NULL) return ((struct ar_hdr *) Hash_GetValue (he)); ! return ((struct ar_hdr *) NULL); } } --- 504,510 ---- } if ((he = Hash_FindEntry (&ar->members, copy)) != NULL) return ((struct ar_hdr *) Hash_GetValue (he)); ! return (NULL); } } *************** *** 521,528 **** arch = ArchFindMember(archive, member, &sarh, "r"); ! if (arch == (FILE *)NULL) { ! return ((struct ar_hdr *)NULL); } else { fclose(arch); return (&sarh); --- 520,527 ---- arch = ArchFindMember(archive, member, &sarh, "r"); ! if (arch == NULL) { ! return (NULL); } else { fclose(arch); return (&sarh); *************** *** 534,541 **** * everything that's in it and cache it so we can get at it quickly. */ arch = fopen (archive, "r"); ! if (arch == (FILE *) NULL) { ! return ((struct ar_hdr *) NULL); } /* --- 533,540 ---- * everything that's in it and cache it so we can get at it quickly. */ arch = fopen (archive, "r"); ! if (arch == NULL) { ! return (NULL); } /* *************** *** 545,551 **** if ((fread (magic, SARMAG, 1, arch) != 1) || (strncmp (magic, ARMAG, SARMAG) != 0)) { fclose (arch); ! return ((struct ar_hdr *) NULL); } ar = (Arch *)emalloc (sizeof (Arch)); --- 544,550 ---- if ((fread (magic, SARMAG, 1, arch) != 1) || (strncmp (magic, ARMAG, SARMAG) != 0)) { fclose (arch); ! return (NULL); } ar = (Arch *)emalloc (sizeof (Arch)); *************** *** 623,629 **** } #endif ! he = Hash_CreateEntry (&ar->members, memName, (Boolean *)NULL); Hash_SetValue (he, (ClientData)emalloc (sizeof (struct ar_hdr))); memcpy ((Address)Hash_GetValue (he), (Address)&arh, sizeof (struct ar_hdr)); --- 622,628 ---- } #endif ! he = Hash_CreateEntry (&ar->members, memName, NULL); Hash_SetValue (he, (ClientData)emalloc (sizeof (struct ar_hdr))); memcpy ((Address)Hash_GetValue (he), (Address)&arh, sizeof (struct ar_hdr)); *************** *** 641,650 **** */ he = Hash_FindEntry (&ar->members, member); ! if (he != (Hash_Entry *) NULL) { return ((struct ar_hdr *) Hash_GetValue (he)); } else { ! return ((struct ar_hdr *) NULL); } badarch: --- 640,649 ---- */ he = Hash_FindEntry (&ar->members, member); ! if (he != NULL) { return ((struct ar_hdr *) Hash_GetValue (he)); } else { ! return (NULL); } badarch: *************** *** 653,659 **** if (ar->fnametab) free(ar->fnametab); free ((Address)ar); ! return ((struct ar_hdr *) NULL); } #ifdef SVR4ARCHIVES --- 652,658 ---- if (ar->fnametab) free(ar->fnametab); free ((Address)ar); ! return (NULL); } #ifdef SVR4ARCHIVES *************** *** 793,800 **** int len, tlen; arch = fopen (archive, mode); ! if (arch == (FILE *) NULL) { ! return ((FILE *) NULL); } /* --- 792,799 ---- int len, tlen; arch = fopen (archive, mode); ! if (arch == NULL) { ! return (NULL); } /* *************** *** 804,810 **** if ((fread (magic, SARMAG, 1, arch) != 1) || (strncmp (magic, ARMAG, SARMAG) != 0)) { fclose (arch); ! return ((FILE *) NULL); } /* --- 803,809 ---- if ((fread (magic, SARMAG, 1, arch) != 1) || (strncmp (magic, ARMAG, SARMAG) != 0)) { fclose (arch); ! return (NULL); } /* *************** *** 829,835 **** * and there's no way we can recover... */ fclose (arch); ! return ((FILE *) NULL); } else if (strncmp (member, arhPtr->ar_name, tlen) == 0) { /* * If the member's name doesn't take up the entire 'name' field, --- 828,834 ---- * and there's no way we can recover... */ fclose (arch); ! return (NULL); } else if (strncmp (member, arhPtr->ar_name, tlen) == 0) { /* * If the member's name doesn't take up the entire 'name' field, *************** *** 905,911 **** * archive and return NULL -- an error. */ fclose (arch); ! return ((FILE *) NULL); } /*- --- 904,910 ---- * archive and return NULL -- an error. */ fclose (arch); ! return (NULL); } /*- *************** *** 940,946 **** free(p2); sprintf(arh.ar_date, "%-12ld", (long) now); ! if (arch != (FILE *) NULL) { (void)fwrite ((char *)&arh, sizeof (struct ar_hdr), 1, arch); fclose (arch); } --- 939,945 ---- free(p2); sprintf(arh.ar_date, "%-12ld", (long) now); ! if (arch != NULL) { (void)fwrite ((char *)&arh, sizeof (struct ar_hdr), 1, arch); fclose (arch); } *************** *** 973,979 **** arch = ArchFindMember (gn->path, RANLIBMAG, &arh, "r+"); sprintf(arh.ar_date, "%-12ld", (long) now); ! if (arch != (FILE *) NULL) { (void)fwrite ((char *)&arh, sizeof (struct ar_hdr), 1, arch); fclose (arch); --- 972,978 ---- arch = ArchFindMember (gn->path, RANLIBMAG, &arh, "r+"); sprintf(arh.ar_date, "%-12ld", (long) now); ! if (arch != NULL) { (void)fwrite ((char *)&arh, sizeof (struct ar_hdr), 1, arch); fclose (arch); *************** *** 1013,1019 **** if (p2) free(p2); ! if (arhPtr != (struct ar_hdr *) NULL) { modTime = (int) strtol(arhPtr->ar_date, NULL, 10); } else { modTime = 0; --- 1012,1018 ---- if (p2) free(p2); ! if (arhPtr != NULL) { modTime = (int) strtol(arhPtr->ar_date, NULL, 10); } else { modTime = 0; *************** *** 1120,1126 **** #ifdef LIBRARIES Var_Set (TARGET, gn->name, gn); #else ! Var_Set (TARGET, gn->path == (char *) NULL ? gn->name : gn->path, gn); #endif /* LIBRARIES */ } --- 1119,1125 ---- #ifdef LIBRARIES Var_Set (TARGET, gn->name, gn); #else ! Var_Set (TARGET, gn->path == NULL ? gn->name : gn->path, gn); #endif /* LIBRARIES */ } *************** *** 1177,1183 **** arhPtr = ArchStatMember (gn->path, RANLIBMAG, FALSE); ! if (arhPtr != (struct ar_hdr *)NULL) { modTimeTOC = (int) strtol(arhPtr->ar_date, NULL, 10); if (DEBUG(ARCH) || DEBUG(MAKE)) { --- 1176,1182 ---- arhPtr = ArchStatMember (gn->path, RANLIBMAG, FALSE); ! if (arhPtr != NULL) { modTimeTOC = (int) strtol(arhPtr->ar_date, NULL, 10); if (DEBUG(ARCH) || DEBUG(MAKE)) {