On 06/17/2011 04:44 AM, Denys Vlasenko wrote: > On Friday 17 June 2011 03:00, Denys Vlasenko wrote: >> On Thursday 16 June 2011 06:51, Timo Teräs wrote: >> sed does not use bb_get_chunk_with_continuation() directly. >> It uses bb_get_chunk_from_file(), which is implemented with >> bb_get_chunk_with_continuation().
Ah, that's good to know. So it's then only sed that needs the thing. I think I saw some comment somewhere that grep might rely on this too. >> >> bb_get_chunk_with_continuation() is used only by config parser, >> and config parser definitely has no need to deal with \0. >> Meaning: it needs to not segfault or hand on files with \0, >> but other than this, it is free to either ignore \0, or replace >> then with space or newline. IOW: whoever has \0 in their *config* >> files is shooting himself in the foot. >> >> The first step would be to unmarry these two functions. > > Done in this commit: > > http://git.busybox.net/busybox/commit/?id=a1a448347e71c9899ad1500cbd8739fd82e1bb91 Did you run the checks if anything broke? > bb_get_chunk_with_continuation -> get_line_with_continuation, > become static in parse_config.c, > lost one parameter and one realloc per line. > > Since now it is nicely localized to parse_config.c, we can optimize it for > speed > further. For example, we can avoid realloc per each line by reusing the same > buffer. Goody. config_* is fairly isolated now, and can be updated separately. I'll try to take the time to optimise this during this weekend. > As to getc_unlocked, well... we can do better that using it only here. > NONE of bbox applets are threaded, does it mean we can simply use > foo_unclocked everywhere by #define magic? Probably. It might need some #ifdef magic to see if the libc we are compiling against exports these. - Timo _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
