Re: [PATCH] Remove isys/str.c, replace calls with glib.h or string.h calls.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/23/2010 12:38 AM, Ales Kozumplik wrote:
> Hi,
> 
> 
> On 03/22/2010 10:07 PM, David Cantrell wrote:
>> str.c was from a time when loader was still a statically linked binary.
>> Times have changed.  Removed str.c and replaced calls with either
>> string.h or glib.h functions.
>>
>> For g_ascii_strup() and g_ascii_strdown(), those functions dup the
>> passed in string, change it, and return that.
>> ---
>> -    } else if (strcount(str, ':')>  1) {
>> +    } else if (strstr(str, ":")) {
> 
> Or even strchr(str, ':') ?

Actually, per the IRC discussion that doesn't do the same thing. The
else block below this expects an ipv4 address with optional :port at the
end so this compare needs to check for 2 colons to confirm that it is an
ipv6 address.

It also needs to handle the case where there are no colons, so comparing
a strchr and a strrchr doesn't work either. I think it needs to look
like this:

} else if ((strchr(str, ':') != NULL) && (strchr(str, ':') !=
strrchr(str, ':'))) {

I don't like calling strchr 2 times, but that's probably about as clean
as adding a temporary char *p to hold the results for the 2nd check.

- -- 
Brian C. Lane <bcl@xxxxxxxxxx>
Red Hat / Port Orchard, WA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEVAwUBS6jkTBF+jBaO/jp/AQLgIwgAkb0apSTTGJJitkvM+pBOPvq2Oj4aT7j+
586NiLyVcD+eKmnQ/g24mtsJ8DYTvtDgc/PwYCdVd8JPqY+oo72CV/3fvDEvX7Mi
OkOP+Oo6MrzgcbA9g9mVTs41OY1Yg2SRSnJfw09q2hgR4pXB4f74cm+yjqcF3wpu
sdR893lWaTULziO4Gf86Sa/D2Dmpfq+iKi4sDMqD9bads9LCcrI2PvCO+5/ufvK1
jq3IMke57wnKiWQrZYeqPKw66WgZbnvoWE8SbtChh27TR5PJ/s6GFUocoucjtAqH
sLfkDqU3Q0xJlielYuobqlqTGf1kVWjI6ToDLNEMR4NZ/WI+6JUJIA==
=o4iF
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux