[PATCH] decouple sprintf and fseek

Denys Vlasenko vda.linux at googlemail.com
Wed Apr 2 14:11:47 UTC 2008


Hi guys,

Can you please review and comment on this bug:

http://busybox.net/bugs/view.php?id=2714

Although I technically can commit this change myself,
I'd much prefer for it to be reviewed by people
who actively work on uclubc codebase.

The same patches are attached to this mail.

Description:

Use of [v]s[n]printf functions seems to pull a bit too much
of stdio.h machinery. Only formatting routines are actually
needed. For one, seek and write functions ideally
should not be linked in.

Seems like it can be improved in _vfprintf.c / old_vfprintf.c
by factoring out "the core" of vprintf() into separate function
(say, "vprintf_internal()"), so that:

* vprintf() does locking and __STDIO_STREAM_TRANS_TO_WRITE thing,
  then calls vprintf_internal();
* vsnprintf, vdprintf.c, vasprintf.c all use
  vprintf_internal_unlocked() directly
  [and do not need to set up fake locking now]
 
2.patch implements this solution.
3.patch removes unneeded initialization of locking.

If you are going to apply it, take a look at vsnprintf.c's
comment about __bufputc - it seems to be bogus, AFAICS
__bufputc initialization has nothing to do with
__user_locking. (I did grep around).

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.patch
Type: text/x-diff
Size: 16000 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20080402/03361b2e/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3.patch
Type: text/x-diff
Size: 2660 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20080402/03361b2e/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.patch
Type: text/x-diff
Size: 16000 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20080402/03361b2e/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3.patch
Type: text/x-diff
Size: 2660 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20080402/03361b2e/attachment-0003.bin 


More information about the uClibc mailing list