lkml.org 
[lkml]   [2015]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/4] perf tools: Add link argument to dso__find_symbol_by_name()
On 1/14/15 5:23 PM, Namhyung Kim wrote:
> On Wed, Jan 14, 2015 at 09:36:34AM -0700, David Ahern wrote:
>>> + /* return first symbol that has same name (if any) */
>>> + for (n = rb_prev(n); n; n = rb_prev(n)) {
>>> + struct symbol_name_rb_node *tmp;
>>> +
>>> + tmp = rb_entry(n, struct symbol_name_rb_node, rb_node);
>>> + if (strcmp(tmp->sym.name, s->sym.name))
>>
>> strcmp() == 0?
>
> No, at this point the 's' points to the first symbol that has same
> name. And if it finds another symbol (tmp) that has same name, it
> updates the s to point to the tmp and continues. Otherwise it returns
> with the existing symbol (s).

I squinted a bit harder at your v3 and realized that. Was not obvious
based on the first reading of the loop.

David


\
 
 \ /
  Last update: 2015-01-15 02:01    [W:0.056 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site