NULL -> '\0'
Submitted by: Bruce, see also c-faq 5.6 and 5.9
This commit is contained in:
parent
7d4c1814f6
commit
daaa458ad4
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: locate.bigram.c,v 1.4 1996/08/22 18:46:11 wosch Exp $
|
||||
* $Id: locate.bigram.c,v 1.5 1996/08/30 03:06:15 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -76,19 +76,19 @@ main(void)
|
||||
continue;
|
||||
|
||||
/* Squelch characters that would botch the decoding. */
|
||||
for (cp = path; *cp != NULL; cp++) {
|
||||
for (cp = path; *cp != '\0'; cp++) {
|
||||
/* chop newline */
|
||||
if (*cp == '\n')
|
||||
*cp = NULL;
|
||||
*cp = '\0';
|
||||
/* range */
|
||||
else if (*cp < ASCII_MIN || *cp > ASCII_MAX)
|
||||
*cp = '?';
|
||||
}
|
||||
|
||||
/* skip longest common prefix */
|
||||
for (cp = path; *cp == *oldpath && *cp != NULL; cp++, oldpath++);
|
||||
for (cp = path; *cp == *oldpath && *cp != '\0'; cp++, oldpath++);
|
||||
|
||||
while (*cp != NULL && *(cp+1) != NULL) {
|
||||
while (*cp != '\0' && *(cp+1) != '\0') {
|
||||
bigram[*cp][*(cp+1)]++;
|
||||
cp += 2;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: locate.code.c,v 1.4 1996/08/22 18:46:13 wosch Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -149,7 +149,7 @@ main(argc, argv)
|
||||
for (j = 0; j < UCHAR_MAX; j++)
|
||||
big[i][j] = (bg_t)-1;
|
||||
|
||||
for (cp = bigrams, i = 0; *cp != NULL; i += 2, cp += 2)
|
||||
for (cp = bigrams, i = 0; *cp != '\0'; i += 2, cp += 2)
|
||||
big[(int)*cp][(int)*(cp + 1)] = (bg_t)i;
|
||||
#endif /* LOOKUP */
|
||||
|
||||
@ -164,17 +164,17 @@ main(argc, argv)
|
||||
continue;
|
||||
|
||||
/* Squelch characters that would botch the decoding. */
|
||||
for (cp = path; *cp != NULL; cp++) {
|
||||
for (cp = path; *cp != '\0'; cp++) {
|
||||
/* chop newline */
|
||||
if (*cp == '\n')
|
||||
*cp = NULL;
|
||||
*cp = '\0';
|
||||
/* range */
|
||||
else if (*cp < ASCII_MIN || *cp > ASCII_MAX)
|
||||
*cp = '?';
|
||||
}
|
||||
|
||||
/* Skip longest common prefix. */
|
||||
for (cp = path; *cp == *oldpath && *cp != NULL; cp++, oldpath++);
|
||||
for (cp = path; *cp == *oldpath && *cp != '\0'; cp++, oldpath++);
|
||||
|
||||
count = cp - path;
|
||||
diffcount = count - oldcount + OFFSET;
|
||||
@ -187,8 +187,8 @@ main(argc, argv)
|
||||
if (putchar(diffcount) == EOF)
|
||||
err(1, "stdout");
|
||||
|
||||
while (*cp != NULL) {
|
||||
if (*(cp + 1) == NULL) {
|
||||
while (*cp != '\0') {
|
||||
if (*(cp + 1) == '\0') {
|
||||
if (putchar(*cp) == EOF)
|
||||
err(1, "stdout");
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user