Changeset 5c13d64 in buchla-68k for libsm/memccpy.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/memccpy.c

    r002f873 r5c13d64  
    44        Version 1 -- 1987-06-12
    55
    6         Copy s2 to s1, stopping if character c is copied.
     6        Copy vp2 to vp1, stopping if character c is copied.
    77        Copy no more than n bytes.
    88        Return a pointer to the byte after character c in the copy,
     
    1111*/
    1212
    13 char *memccpy(char *s1, char *s2, char c, int n)
     13void *memccpy(void *vp1, void *vp2, char c, int n)
    1414{
    15         while (--n >= 0)
    16                 if ((*s1++ = *s2++) == c)
    17                         return(s1);
    18         return((char *)0);
     15        char *cp1 = vp1;
     16        char *cp2 = vp2;
     17
     18        while (--n >= 0)
     19                if ((*cp1++ = *cp2++) == c)
     20                        return(cp1);
     21
     22        return((void *)0);
    1923}
Note: See TracChangeset for help on using the changeset viewer.