# [PATCH] trace2: fix incorrect function pointer check

4 messages from 2019-04-25 to 2019-04-29. Participants: Josh Steadmon, Derrick Stolee, Junio C Hamano, Jeff Hostetler.
Thread: https://gitlist.dev/t/50992

## Josh Steadmon, 2019-04-25 17:08

Subject: [PATCH] trace2: fix incorrect function pointer check
Message-ID: <548a9b833f4569c526cf94c048ae115a76d54be9.1556211995.git.steadmon@google.com>
URL: https://gitlist.dev/e/548a9b833f4569c526cf94c048ae115a76d54be9.1556211995.git.steadmon%40google.com

```
Fix trace2_data_json_fl() to check for the presence of pfn_data_json_fl
in its targets, rather than pfn_data_fl, which is not actually called.

Signed-off-by: Josh Steadmon <steadmon@google.com>
---
 trace2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/trace2.c b/trace2.c
index 8bbad56887..a73cfdf6fe 100644
--- a/trace2.c
+++ b/trace2.c
@@ -717,7 +717,7 @@ void trace2_data_json_fl(const char *file, int line, const char *category,
 	us_elapsed_region = tr2tls_region_elasped_self(us_now);
 
 	for_each_wanted_builtin (j, tgt_j)
-		if (tgt_j->pfn_data_fl)
+		if (tgt_j->pfn_data_json_fl)
 			tgt_j->pfn_data_json_fl(file, line, us_elapsed_absolute,
 						us_elapsed_region, category,
 						repo, key, value);
-- 
2.21.0.593.g511ec345e18-goog


```

## Derrick Stolee, 2019-04-25 18:46

Subject: Re: [PATCH] trace2: fix incorrect function pointer check
Message-ID: <20ceb5c3-f64f-be77-2d11-cb41a7045642@gmail.com>
URL: https://gitlist.dev/e/20ceb5c3-f64f-be77-2d11-cb41a7045642%40gmail.com
In-Reply-To: <548a9b833f4569c526cf94c048ae115a76d54be9.1556211995.git.steadmon@google.com>

```
On 4/25/2019 1:08 PM, Josh Steadmon wrote:
> Fix trace2_data_json_fl() to check for the presence of pfn_data_json_fl
> in its targets, rather than pfn_data_fl, which is not actually called.

[snip]

>  	for_each_wanted_builtin (j, tgt_j)
> -		if (tgt_j->pfn_data_fl)
> +		if (tgt_j->pfn_data_json_fl)
>  			tgt_j->pfn_data_json_fl(file, line, us_elapsed_absolute,

Seems obviously correct. Thanks!

-Stolee


```

## Junio C Hamano, 2019-04-26 02:42

Subject: Re: [PATCH] trace2: fix incorrect function pointer check
Message-ID: <xmqq36m5wkqj.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqq36m5wkqj.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <20ceb5c3-f64f-be77-2d11-cb41a7045642@gmail.com>

```
Derrick Stolee <stolee@gmail.com> writes:

> On 4/25/2019 1:08 PM, Josh Steadmon wrote:
>> Fix trace2_data_json_fl() to check for the presence of pfn_data_json_fl
>> in its targets, rather than pfn_data_fl, which is not actually called.
>
> [snip]
>
>>  	for_each_wanted_builtin (j, tgt_j)
>> -		if (tgt_j->pfn_data_fl)
>> +		if (tgt_j->pfn_data_json_fl)
>>  			tgt_j->pfn_data_json_fl(file, line, us_elapsed_absolute,
>
> Seems obviously correct. Thanks!
>
> -Stolee

Thanks, both.  It is embarrassing and sad that nobody caught it
before it hit my tree X-<.

```

## Jeff Hostetler, 2019-04-29 13:01

Subject: Re: [PATCH] trace2: fix incorrect function pointer check
Message-ID: <09415b8f-d07f-5928-06d3-d905a7a30c09@jeffhostetler.com>
URL: https://gitlist.dev/e/09415b8f-d07f-5928-06d3-d905a7a30c09%40jeffhostetler.com
In-Reply-To: <548a9b833f4569c526cf94c048ae115a76d54be9.1556211995.git.steadmon@google.com>

```


On 4/25/2019 1:08 PM, Josh Steadmon wrote:
> Fix trace2_data_json_fl() to check for the presence of pfn_data_json_fl
> in its targets, rather than pfn_data_fl, which is not actually called.
> 
> Signed-off-by: Josh Steadmon <steadmon@google.com>
> ---
>   trace2.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/trace2.c b/trace2.c
> index 8bbad56887..a73cfdf6fe 100644
> --- a/trace2.c
> +++ b/trace2.c
> @@ -717,7 +717,7 @@ void trace2_data_json_fl(const char *file, int line, const char *category,
>   	us_elapsed_region = tr2tls_region_elasped_self(us_now);
>   
>   	for_each_wanted_builtin (j, tgt_j)
> -		if (tgt_j->pfn_data_fl)
> +		if (tgt_j->pfn_data_json_fl)
>   			tgt_j->pfn_data_json_fl(file, line, us_elapsed_absolute,
>   						us_elapsed_region, category,
>   						repo, key, value);
> 

good catch.  thanks.

Jeff

```
