mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-09 03:58:18 -04:00
Fix strswab() to reliably find end of string
Patch by Andrew Dyer, 08 Feb 2005
This commit is contained in:
parent
6ed6ce62be
commit
389db1f113
@ -2,6 +2,9 @@
|
|||||||
Changes for U-Boot 1.1.4:
|
Changes for U-Boot 1.1.4:
|
||||||
======================================================================
|
======================================================================
|
||||||
|
|
||||||
|
* Fix strswab() to reliably find end of string
|
||||||
|
Patch by Andrew Dyer, 08 Feb 2005
|
||||||
|
|
||||||
* Fix typos in include/ppc440.h
|
* Fix typos in include/ppc440.h
|
||||||
Patch by Andrew E Mileski, 04 Feb 2005
|
Patch by Andrew E Mileski, 04 Feb 2005
|
||||||
|
|
||||||
|
@ -374,17 +374,18 @@ char * strsep(char **s, const char *ct)
|
|||||||
*/
|
*/
|
||||||
char *strswab(const char *s)
|
char *strswab(const char *s)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p, *q;
|
||||||
|
|
||||||
if ((NULL == s) || ('\0' == *s)) {
|
if ((NULL == s) || ('\0' == *s)) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (p = ((char *)s + 1); '\0' != *p; p += 2) {
|
for (p=(char *)s, q=p+1; (*p != '\0') && (*p != '\0'); p+=2, q+=2) {
|
||||||
char tmp;
|
char tmp;
|
||||||
tmp = *(p-1);
|
|
||||||
*(p-1) = *p;
|
tmp = *p;
|
||||||
*p = tmp;
|
*p = *q;
|
||||||
|
*q = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (char *) s;
|
return (char *) s;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user