Andree Leidenfrost said on Mon, May 15, 2006 at 11:05:10PM +1000:
Salut Bruno,
Halo Andree !
J'espère que tu as passé un bon week-end!
Ya es war ganz gut hier auch ;-)
Please find attached my suggestion for mr_strtok() which features the
following improvements over strtok():
- thread-safety
- input string remains unchanged
- concise code
Integrated in stable r557.
Will be in 2.0.8.
to me, no compiler warnings with '-Wall', but there are valgrind errors
(see mr_strtok_demo.valgrind in attached tar ball) for both strspn()
and strcspn() which may or may not be genuine but at any rate should be
about bespoke functions rather than my use of them. (I may be wrong
though.)
I do not have those error with my valgrind:
==21555== Conditional jump or move depends on uninitialised value(s)
==21555==at 0x1B8F56BF: index (strchr.S:177)
==21555==
==21555== Conditional jump or move depends on uninitialised value(s)
==21555==at 0x1B8F56D0: index (strchr.S:183)
string=|md0 : active raid10 hda1[0] hda12[3] hda6[2] hda5[1]
|
==21555==
==21555== Conditional jump or move depends on uninitialised value(s)
==21555==at 0x1B901285: strlen (mac_replace_strmem.c:243)
==21555==by 0x1B9611F2: vfprintf (in /lib/tls/libc-2.3.6.so)
==21555==by 0x1B966682: printf (in /lib/tls/libc-2.3.6.so)
==21555==by 0x8048641: main (mr_strtok_demo.c:44)
token=|md0|, lastpos=4
token=|active|, lastpos=13
token=|raid10|, lastpos=20
token=|hda1[|, lastpos=26
token=|]|, lastpos=28
token=|hda12[3]|, lastpos=37
token=|hda6[2]|, lastpos=45
token=|hda5[1]|, lastpos=53
==21555==
==21555== ERROR SUMMARY: 10 errors from 3 contexts (suppressed: 17 from
2)
==21555== malloc/free: in use at exit: 0 bytes in 0 blocks.
==21555== malloc/free: 10 allocs, 10 frees, 205 bytes allocated.
==21555== For counts of detected errors, rerun with: -v
==21555== No malloc'd blocks -- no leaks are possible.
It would be super cool if you could take the sample code for a spin and
let me know what you think! Or, to talk in (hopefully correct French)
acronyms, QTP*?
I would say QPT ** ?
Answer is : Très bien !!
I put the test program in my trunk tree (local) and will sync it with
the rest later on.
À la revoyure!
Oh, nice one :-)
Tschüß,
Bruno.
* Quesque tu pense?
** Qu'en penses-tu ?
--
Linux Profession Lead EMEA / Open Source Evangelist \HP CI EMEA IET
http://www.mondorescue.org / HP/Intel Solution Center \ http://hpintelco.net
Des infos sur Linux? http://www.HyPer-Linux.org http://www.hp.com/linux
La musique ancienne? http://www.musique-ancienne.org http://www.medieval.org
pgpnLt9pY69xj.pgp
Description: PGP signature