libroot: Replace swab() with the musl version.

This was the last function remaining in the glibc "string" directory,
so now we can remove that directory and a bunch of related files
that are no longer needed.
This commit is contained in:
Augustin Cavalier 2020-01-18 20:26:05 -05:00
parent f19586ee86
commit aa1e42a332
6 changed files with 18 additions and 54 deletions

View File

@ -47,7 +47,6 @@ for architectureObject in [ MultiArchSubDirSetup ] {
posix_gnu_regex.o
posix_gnu_stdio.o
posix_gnu_stdlib.o
posix_gnu_string.o
posix_gnu_wcsmbs.o
posix_stdlib.o
posix_string.o

View File

@ -15,5 +15,4 @@ SubInclude HAIKU_TOP src system libroot posix glibc misc ;
SubInclude HAIKU_TOP src system libroot posix glibc regex ;
SubInclude HAIKU_TOP src system libroot posix glibc stdio-common ;
SubInclude HAIKU_TOP src system libroot posix glibc stdlib ;
SubInclude HAIKU_TOP src system libroot posix glibc string ;
SubInclude HAIKU_TOP src system libroot posix glibc wcsmbs ;

View File

@ -1,18 +0,0 @@
SubDir HAIKU_TOP src system libroot posix glibc string ;
local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] {
on $(architectureObject) {
local architecture = $(TARGET_PACKAGING_ARCH) ;
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch
$(TARGET_ARCH) ;
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch
generic ;
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include ;
MergeObject <$(architecture)>posix_gnu_string.o :
swab.c
;
}
}

View File

@ -1,34 +0,0 @@
/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <unistd.h>
void
swab (const void *bfrom, void *bto, ssize_t n)
{
const char *from = (const char *) bfrom;
char *to = (char *) bto;
n &= ~((ssize_t) 1);
while (n > 1)
{
const char b0 = from[--n], b1 = from[--n];
to[n] = b0;
to[n + 1] = b1;
}
}

View File

@ -10,6 +10,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
MergeObject <$(architecture)>posix_musl_string.o :
memrchr.c
swab.c
;
}
}

View File

@ -0,0 +1,17 @@
#include <unistd.h>
#if __GNUC__ < 4
#define restrict
#endif
void swab(const void *restrict _src, void *restrict _dest, ssize_t n)
{
const char *src = _src;
char *dest = _dest;
for (; n>1; n-=2) {
dest[0] = src[1];
dest[1] = src[0];
dest += 2;
src += 2;
}
}