On 01:11 Wed 25 Apr     , Yevgeny Kliteynik wrote:
> Michael S. Tsirkin wrote:
> >Since you seem to do a strcat which does an anyway, how about, for example:
> >
> >-      sprintf( buf_line1,"%s 0x%01x |",
> >-               buf_line1, p_vla_tbl->vl_entry[i].vl);
> >+      sprintf( buf_line1 + strlen(buf_line1)," 0x%01x |",
> >+               p_vla_tbl->vl_entry[i].vl);
> >
> >and so on in all the other places?
> 
> Agree.
> I'll send a new patch later.

Or like this:

+      int n = 0;
...
-      sprintf( buf_line1,"%s 0x%01x |",
-               buf_line1, p_vla_tbl->vl_entry[i].vl);
+      n += sprintf( buf_line1 + n," 0x%01x |",
+                    p_vla_tbl->vl_entry[i].vl);

, so strlen() rerunning in loop is not needed anymore.

Sasha
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to