Changeset 5c13d64 in buchla-68k for libsm/memchr.c


Ignore:
Timestamp:
07/09/2017 01:36:31 PM (7 years ago)
Author:
Thomas Lopatic <thomas@…>
Branches:
master
Children:
0292fbb
Parents:
002f873
Message:

Use void pointers for mem*() functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libsm/memchr.c

    r002f873 r5c13d64  
    44        Version 1 -- 1987-06-12
    55
    6         Return the ptr in sp at which the character c appears;
     6        Return the ptr in vp at which the character c appears;
    77        NULL if not found in n chars; don't stop at \0.
    88   =============================================================================
    99*/
    1010
    11 char *memchr(char *sp, char c, int n)
     11void *memchr(void *vp, char c, int n)
    1212{
    13         while (--n >= 0)
    14                 if (*sp++ == c)
    15                         return(--sp);
    16         return((char *)0);
     13        char *cp = vp;
     14
     15        while (--n >= 0)
     16                if (*cp++ == c)
     17                        return(--cp);
     18
     19        return((void *)0);
    1720}
Note: See TracChangeset for help on using the changeset viewer.