~mingw-w64/mingw-w64/experimental

« back to all changes in this revision

Viewing changes to libw64crt/string/memccpy.c

  • Committer: ktietz70
  • Date: 2009-12-07 19:49:25 UTC
  • Revision ID: svn-v4:4407c894-4637-0410-b4f5-ada5f102cad1:experimental:1611
Rename to iCrt (ironCrate)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <w64crt.h>
2
 
#include <w64string.h>
3
 
 
4
 
void *
5
 
memccpy (void *d, const void *s, int end, size_t n)
6
 
{
7
 
  const char *sc, *se;
8
 
  char *dc, *ret = NULL;
9
 
 
10
 
  dc = (char *) d;
11
 
  sc = (const char *) s;
12
 
  se = sc + n;
13
 
  if (se != sc)
14
 
    {
15
 
      do {
16
 
        *dc++ = *sc++;
17
 
        if (sc[-1] == end)
18
 
          {
19
 
            ret = dc;
20
 
            break;
21
 
          }
22
 
      } while (sc < se);
23
 
    }
24
 
  return ret;
25
 
}
26