This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix memory leak in printf_positional


On Wed, Sep 2, 2015 at 3:07 AM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Tue, 1 Sep 2015, Paul Pluzhnikov wrote:

> #define str1(x) #x
> #define str(x) str1(x)
> #define strc(a,b,c) str(a##b##c)
> #define e(x,y,z) "%"strc(x,y,z)"$s "
> #define f(x,y) e(x,y,0) e(x,y,1) e(x,y,2) e(x,y,3) e(x,y,4) e(x,y,5) e(x,y,6) e(x,y,7) e(x,y,8) e(x,y,9)
> #define g(x) f(x,0) f(x,1) f(x,2) f(x,3) f(x,4) f(x,5) f(x,6) f(x,7) f(x,8) f(x,9)
> g(0) g(1) g(2) g(3) g(4) g(5) g(6) g(7) g(8) g(9)
>
> (that example produces numbers with leading 0s, but you can produce
> numbers with 1, 2, 3 and 4 digits separately to avoid that).

I think at that point it becomes easier to just use a generator script
to write the test. Any objection to that?

Thanks,
-- 
Paul Pluzhnikov


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]