mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Subject: Re: [musl] Question: Why vfprintf call twice printf_core?
Date: Sat, 6 May 2023 05:53:40 +0200	[thread overview]
Message-ID: <ZFXPREkU6s3xeo04@voyager> (raw)
In-Reply-To: <tencent_78DED1C65E5C5DF08830E6F3251C6BFC4F06@qq.com>

Am Sat, May 06, 2023 at 11:29:36AM +0800 schrieb 847567161:
> Hello,
>     I'm analyzing vfprintf performance, I don't know why musl call
>     "printf_core(0, fmt, &amp;ap2, nl_arg, nl_type)" here. Could you
>     tell me the reason?
>     https://gitee.com/openharmony/third_party_musl/blob/master/src/stdio/vfprintf.c#L668
>     More info:    I use gdb to debug vfprintf , I found it return
>     directly when calling printf_core firstly which file parameter is
>     0.
>     https://gitee.com/openharmony/third_party_musl/blob/master/src/stdio/vfprintf.c#L526
>     Best Regards Chuang Yin

First call to printf_core() checks to see if there are any major
problems with the format string, and if the string is using positional
arguments (e.g. "%2$d"), also establishes the types of these arguments
and writes them into an array. Second call does the actual work.

The shortcut after the first printf_core() call is an error exit. That
means the format string is invalid. Could you tell us what the format
string is in your case?

Additionally, there is something weird with your mail client; it is
writing HTML entities into the plain text.

Ciao,
Markus

  reply	other threads:[~2023-05-06  3:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-06  3:29 847567161
2023-05-06  3:53 ` Markus Wichmann [this message]
2023-05-06  5:24   ` =?gb18030?B?ODQ3NTY3MTYx?=
2023-05-06  6:25     ` Markus Wichmann
2023-05-06 17:55       ` NRK
2023-05-07  1:17       ` Rich Felker
2023-05-07  1:44         ` [musl] =?gb18030?B?u9i4tKO6IFttdXNsXSBRdWVzdGlvbjogV2h5IHZmcHJpbnRmIGNhbGwgdHdpY2UgcHJpbnRmX2NvcmU/?= =?gb18030?B?ODQ3NTY3MTYx?=

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZFXPREkU6s3xeo04@voyager \
    --to=nullplan@gmx.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).