Home | History | Annotate | Download | only in string
History log of /src/lib/libc/string/swab.c
RevisionDateAuthorComments
 1.20  28-Dec-2022  riastradh swab(3): Rewrite this to be understandable.

And make the tests work, and exercise all lengths up to 100.

Evidently the previous definition, presumably tightly optimized for
1980s-era compilers and CPUs, was too hard to understand, because it
was incorrectly tested for two decades and broken for years.

PR lib/57141

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.19  28-Dec-2022  kre PR lib/57141 - never decrement len without actually performing a STEP.
 1.18  04-Jan-2011  martin branches: 1.18.38; 1.18.48; 1.18.56;
Special-case the (unlikely in practice) call with len = 2 - previously
the code would not have swapped anything. Problem pointed out by
sparc64 automatic test run.
 1.17  18-Apr-2010  apb The number of byte pairs to swap is len/2, not len/2+1.
 1.16  18-Apr-2010  apb Bitwise operations on signed types are well-defined if the values
happen to be positive, and indeed the values here were guaranteed
to be positive, but some compilers complained anyway, so convert
the bitwise operations to arithmetic operations.
 1.15  18-Apr-2010  christos simplify
 1.14  17-Apr-2010  christos fix lint
 1.13  17-Apr-2010  christos Change and document for POSIX compliance.
 1.12  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.11  22-May-2001  christos fix incorrect loop sentinel caused by previous de-linting.
 1.10  26-Jan-2001  wiz branches: 1.10.2;
ANSIfy and de-lint. Reviewed by christos.
 1.9  20-Sep-1999  lukem back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.
_DIAGASSERT() is still retained.
 1.8  16-Sep-1999  lukem * use _DIAGASSERT() to check pointer arguments against NULL and file
descriptors against -1 (as appropriate).
* add actual checks which to detect stuff that would trigger_DIAGASSERT(),
and attempt to return a sane error condition.
* knf some code
* remove some `register' decls.

the first two items result in the addition of code similar to the
following in various functions:

_DIAGASSERT(path != NULL)
#ifdef _DIAGNOSTIC
if (path == NULL) {
errno = EFAULT;
return (-1);
}
#endif
 1.7  03-Feb-1998  perry remove obsolete register declarations
 1.6  30-Jan-1998  perry update to lite-2
 1.5  12-Jan-1998  kleink Per XPG4, move the prototype of swab() from <string.h> to <unistd.h>.
 1.4  13-Jul-1997  christos Fix RCSID's
Use "extern.h" where appropriate.
 1.3  26-Aug-1993  jtc branches: 1.3.8;
Declare rcsid strings so they are stored in text segment.
 1.2  01-Aug-1993  mycroft Add RCS identifiers.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  30-Jan-1998  perry import lite-2
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.3.8.1  20-Sep-1996  jtc snapshot namespace cleanup: net, etc.
 1.10.2.1  08-Oct-2001  nathanw Catch up to -current.
 1.18.56.1  22-Feb-2023  martin Pull up following revision(s) (requested by riastradh in ticket #98):

tests/lib/libc/string/t_swab.c: revision 1.3
lib/libc/string/swab.c: revision 1.20

swab(3): Rewrite this to be understandable.

And make the tests work, and exercise all lengths up to 100.
Evidently the previous definition, presumably tightly optimized for
1980s-era compilers and CPUs, was too hard to understand, because it
was incorrectly tested for two decades and broken for years.

PR lib/57141
 1.18.48.1  22-Feb-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1601):

tests/lib/libc/string/t_swab.c: revision 1.3
lib/libc/string/swab.c: revision 1.20

swab(3): Rewrite this to be understandable.

And make the tests work, and exercise all lengths up to 100.
Evidently the previous definition, presumably tightly optimized for
1980s-era compilers and CPUs, was too hard to understand, because it
was incorrectly tested for two decades and broken for years.

PR lib/57141
 1.18.38.1  22-Feb-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1798):

tests/lib/libc/string/t_swab.c: revision 1.3
lib/libc/string/swab.c: revision 1.20

swab(3): Rewrite this to be understandable.

And make the tests work, and exercise all lengths up to 100.
Evidently the previous definition, presumably tightly optimized for
1980s-era compilers and CPUs, was too hard to understand, because it
was incorrectly tested for two decades and broken for years.

PR lib/57141

RSS XML Feed