Ignore:
Timestamp:
Jun 17, 2005, 6:32:39 AM (20 years ago)
Author:
bird
Message:

Porting to 64-bit FreeBSD...

Location:
trunk/src/libctests/glibc/string
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libctests/glibc/string/test-memccpy.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2043 r2044  
    4848
    4949  if (p != NULL)
     50#if 0
    5051    return mempcpy (dst, src, p - src + 1);
     52#else
     53    {
     54      memcpy (dst, src, p - src + 1);
     55      return (char *)dst + ((char *)p - (char *)src + 1);
     56    }
     57#endif
    5158
    5259  memcpy (dst, src, n);
  • trunk/src/libctests/glibc/string/test-string.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2043 r2044  
    5252#define GLRO(x) _##x
    5353#include <hp-timing.h>
     54
     55/* bird added for bsd */
     56#ifndef TEMP_FAILURE_RETRY /* special GNU idea */
     57# define TEMP_FAILURE_RETRY(expression) \
     58  (__extension__                                                              \
     59    ({ long int __result;                                                     \
     60       do __result = (long int) (expression);                                 \
     61       while (__result == -1L && errno == EINTR);                             \
     62       __result; }))
     63#endif
     64#ifndef HAVE_STRNLEN
     65static inline size_t strnlen(const char *psz, size_t cch)
     66{
     67    const char *psz2 = psz;
     68    while (cch > 0 && *psz)
     69        cch--, psz++;
     70    return psz - psz2;
     71}
     72#endif
    5473
    5574
  • trunk/src/libctests/glibc/string/testcopy.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2043 r2044  
    2121#include <stdio.h>
    2222#include <string.h>
    23 #include <malloc.h>
     23/* #include <malloc.h> - <malloc.h> has been replaced by <stdlib.h>" */
    2424
    2525int
  • trunk/src/libctests/glibc/string/tester.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2043 r2044  
    267267test_stpncpy (void)
    268268{
     269#ifdef HAVE_STPNCPY
    269270  it = "stpncpy";
    270271  memset (one, 'x', sizeof (one));
     
    277278  check (stpncpy (one, "abcd", 6) == one + 4, 7);
    278279  check (one[4] == '\0' && one[5] == '\0' && one[6] == 'x', 8);
     280#endif
    279281}
    280282
     
    466468test_strchrnul (void)
    467469{
     470#ifdef HAVE_STRCHRNUL
    468471  const char *os;
    469472  it = "strchrnul";
     
    495498      }
    496499   }
     500#endif
    497501}
    498502
     
    500504test_rawmemchr (void)
    501505{
     506#ifdef HAVE_RAWMEMCHR
    502507  it = "rawmemchr";
    503508  (void) strcpy (one, "abcd");
     
    522527      }
    523528   }
     529#endif
    524530}
    525531
     
    573579test_memrchr (void)
    574580{
     581#ifdef HAVE_MEMRCHR
    575582  size_t l;
    576583  it = "memrchr";
     
    614621    }
    615622  }
     623 #endif
    616624}
    617625
     
    825833test_strsep (void)
    826834{
     835#ifdef HAVE_STRSEP
    827836  char *ptr;
    828837  it = "strsep";
     
    953962  check(ptr == one , 87);
    954963  check(cp == NULL, 88);
     964#endif
    955965}
    956966
     
    10521062test_mempcpy (void)
    10531063{
     1064#ifdef HAVE_MEMPCPY
    10541065  int i;
    10551066  it = "mempcpy";
     
    10841095      equal (two, "hi there", 12 + (i * 6));
    10851096    }
     1097#endif
    10861098}
    10871099
     
    12631275}
    12641276
     1277
    12651278static void
    12661279test_strndup (void)
    12671280{
     1281#ifdef HAVE_STRNDUP
    12681282  char *p, *q;
    12691283  it = "strndup";
     
    12851299    equal(p, "abc", 6);
    12861300  free (p);
     1301#endif
    12871302}
    12881303
  • trunk/src/libctests/glibc/string/tst-strlen.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2043 r2044  
    55#include <stdio.h>
    66#include <string.h>
     7
     8#ifndef HAVE_STRNLEN
     9static inline size_t strnlen(const char *psz, size_t cch)
     10{
     11    const char *psz2 = psz;
     12    while (cch > 0 && *psz)
     13        cch--, psz++;
     14    return psz - psz2;
     15}
     16#endif
    717
    818int
  • trunk/src/libctests/glibc/string/tst-strxfrm.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2043 r2044  
    1616  size_t l;
    1717  char *buf;
     18#ifdef HAVE_NEWLOCALE
    1819  locale_t loc;
     20#endif
    1921  int result = 0;
    2022
     
    4042    }
    4143
     44#ifdef HAVE_NEWLOCALE
    4245  loc = newlocale (1 << LC_ALL, locale, NULL);
    4346
     
    5255
    5356  freelocale (loc);
     57#endif
    5458
    5559  free (buf);
     
    6569
    6670  result |= test ("C");
     71#ifdef __BSD__ /* bsd is missing the aliases. loosers. */
     72  result |= test ("en_US.ISO8859-1");
     73#else
    6774  result |= test ("en_US.ISO-8859-1");
     75#endif
    6876  result |= test ("de_DE.UTF-8");
    6977
Note: See TracChangeset for help on using the changeset viewer.