[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] printf: allow 0 as a flag and allow multiple flags
From:       Ron Yorston <rmy () pobox ! com>
Date:       2021-12-19 14:58:25
Message-ID: 61bf4891.9vMtZmfC6NdlgkJ3%rmy () pobox ! com
[Download RAW message or body]

David Laight wrote:
>Or:
>				tmp = strspn(f, "-+ #0");
>				direc_length += tmp - f;
>				f = tmp;

Yes, that seems to work too, and it saves 28 bytes.  Though since
strspn() returns the length of the initial segment it needs to be:

   size_t tmp;
   ...
   tmp = strspn(f, "-+ #0");                                         
   direc_length += tmp;                                             
   f += tmp;

>Except that I'd have thought it would need to remember which flags are set.

They're retained in the format string which is pointed to by direc_start.

Ron
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic