[PATCH] don't use strptime if we can

Rob Landley rob at landley.net
Thu Feb 16 19:13:03 UTC 2006


On Thursday 16 February 2006 6:46 am, Denis Vlasenko wrote:
> strptime() is large (at least glibc one):

The glibc version of everything is big. :)

How big is the uClibc version?

> strptime() is used in sort.c (if CONFIG_FEATURE_SORT_BIG)
> and tune2fs.c
>
> tune2fs.c already has alternative code and we can use it.
> sort.c is harder, I just added a FIXME.

I wrote the current sort.c.

Sort.c uses strptime for -M, which is Month sort.  Although I can easily 
hardwire in JAN-DEC strings, those are english.

If everybody's ok with hardwired english strings, this becomes a trivial for 
loop, something like:

for(i=12;i;i--)
  if(!strncasecmp("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC",data+3*(i-1),3))
    break;

Possibly pointer traversal could make it even smaller...

On the other hand, it's not a FIXME if the uClibc version is sufficiently 
small and gives the possibility of internationalization support.

This is a gnu extension, so possibly breaking out gnu extensions as a separate 
CONFIG item would make sense too...

> --
> vda

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list