# [PATCH] api-trace.txt: fix typo

3 messages from 2016-04-05 to 2016-04-05. Participants: Elia Pinto, Eric Sunshine, Junio C Hamano.
Thread: https://gitlist.dev/t/41928

## Elia Pinto, 2016-04-05 10:05

Subject: [PATCH] api-trace.txt: fix typo
Message-ID: <1459850723-46974-1-git-send-email-gitter.spiros@gmail.com>
URL: https://gitlist.dev/e/1459850723-46974-1-git-send-email-gitter.spiros%40gmail.com

```
The correct api is trace_printf_key

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 Documentation/technical/api-trace.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/technical/api-trace.txt b/Documentation/technical/api-trace.txt
index 389ae16..45a0ecd 100644
--- a/Documentation/technical/api-trace.txt
+++ b/Documentation/technical/api-trace.txt
@@ -28,7 +28,7 @@ static struct trace_key trace_foo = TRACE_KEY_INIT(FOO);
 
 static void trace_print_foo(const char *message)
 {
-	trace_print_key(&trace_foo, message);
+	trace_printf_key(&trace_foo, message);
 }
 ------------
 +
-- 
2.8.0.270.g9d4de1f.dirty

```

## Eric Sunshine, 2016-04-05 17:15

Subject: Re: [PATCH] api-trace.txt: fix typo
Message-ID: <CAPig+cRO22wVRkrMicxLe=Gw4905QMxnnxM8kvtsMJaFv76Yrg@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcRO22wVRkrMicxLe%3DGw4905QMxnnxM8kvtsMJaFv76Yrg%40mail.gmail.com
In-Reply-To: <1459850723-46974-1-git-send-email-gitter.spiros@gmail.com>

```
On Tue, Apr 5, 2016 at 6:05 AM, Elia Pinto <gitter.spiros@gmail.com> wrote:
> The correct api is trace_printf_key
>
> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
> ---
> diff --git a/Documentation/technical/api-trace.txt b/Documentation/technical/api-trace.txt
> @@ -28,7 +28,7 @@ static struct trace_key trace_foo = TRACE_KEY_INIT(FOO);
>  static void trace_print_foo(const char *message)
>  {
> -       trace_print_key(&trace_foo, message);
> +       trace_printf_key(&trace_foo, message);
>  }

Since you're touching this already, I wonder if it would make sense to
rewrite this example to avoid the dangerous sending of an arbitrary
string (which might contain %) to a printf-like function. Like this,
for example:

    trace_printf_key(&trace_foo, "%s", message);

```

## Junio C Hamano, 2016-04-05 20:49

Subject: Re: [PATCH] api-trace.txt: fix typo
Message-ID: <xmqqvb3v233e.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqvb3v233e.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <CAPig+cRO22wVRkrMicxLe=Gw4905QMxnnxM8kvtsMJaFv76Yrg@mail.gmail.com>

```
Eric Sunshine <sunshine@sunshineco.com> writes:

> On Tue, Apr 5, 2016 at 6:05 AM, Elia Pinto <gitter.spiros@gmail.com> wrote:
>> The correct api is trace_printf_key
>>
>> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
>> ---
>> diff --git a/Documentation/technical/api-trace.txt b/Documentation/technical/api-trace.txt
>> @@ -28,7 +28,7 @@ static struct trace_key trace_foo = TRACE_KEY_INIT(FOO);
>>  static void trace_print_foo(const char *message)
>>  {
>> -       trace_print_key(&trace_foo, message);
>> +       trace_printf_key(&trace_foo, message);
>>  }
>
> Since you're touching this already, I wonder if it would make sense to
> rewrite this example to avoid the dangerous sending of an arbitrary
> string (which might contain %) to a printf-like function. Like this,
> for example:
>
>     trace_printf_key(&trace_foo, "%s", message);

Thanks, will squash in.

```
