Hi Sasha,<br><br>
<div class="gmail_quote">On Thu, Jul 30, 2009 at 5:33 AM, Sasha Khapyorsky <span dir="ltr"><<a href="mailto:sashak@voltaire.com" target="_blank">sashak@voltaire.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi Hal,<br>
<div><br>On 16:22 Mon 27 Jul     , Hal Rosenstock wrote:<br>><br>> Signed-off-by: Hal Rosenstock <<a href="mailto:hal.rosenstock@gmail.com" target="_blank">hal.rosenstock@gmail.com</a>><br>> ---<br>> diff --git a/opensm/opensm/osm_ucast_lash.c b/opensm/opensm/osm_ucast_lash.c<br>
> index 7133e25..a139bdb 100644<br>> --- a/opensm/opensm/osm_ucast_lash.c<br>> +++ b/opensm/opensm/osm_ucast_lash.c<br>> @@ -296,8 +296,8 @@ static void shortest_path(lash_t * p_lash, int ir)<br>>       cl_list_destroy(&bfsq);<br>
>  }<br>><br>> -static void generate_routing_func_for_mst(lash_t * p_lash, int sw_id,<br>> -                                       reachable_dest_t ** destinations)<br>> +static boolean_t generate_routing_func_for_mst(lash_t * p_lash, int sw_id,<br>
> +                                            reachable_dest_t ** destinations)<br><br></div>I think that 'int' is more suitable and simpler for using as return<br>status value.<br>
<div><br>>  {<br>>       int i, next_switch;<br>>       switch_t *sw = p_lash->switches[sw_id];<br>> @@ -306,7 +306,8 @@ static void generate_routing_func_for_mst(lash_t * p_lash, int sw_id,<br>><br>>       for (i = 0; i < num_channels; i++) {<br>
>               next_switch = sw->dij_channels[i];<br>> -             generate_routing_func_for_mst(p_lash, next_switch, &dest);<br>> +             if (!generate_routing_func_for_mst(p_lash, next_switch, &dest))<br>
> +                     return FALSE;<br><br></div>BTW, it looks like a BFS. Could recursion be avoided here?</blockquote>
<div> </div>
<div>Why do you want to eliminate the recursion ?</div>
<div> </div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><span></span><br>
<div><br>><br>>               i_dest = dest;<br>>               prev = i_dest;<br>> @@ -327,9 +328,15 @@ static void generate_routing_func_for_mst(lash_t * p_lash, int sw_id,<br>>       }<br>><br>>       i_dest = (reachable_dest_t *) malloc(sizeof(reachable_dest_t));<br>
> -     i_dest->switch_id = sw->id;<br>> -     i_dest->next = concat_dest;<br>> +     if (i_dest) {<br>> +             i_dest->switch_id = sw->id;<br>> +             i_dest->next = concat_dest;<br>
> +     }<br>>       *destinations = i_dest;<br>> +     if (i_dest)<br>> +             return TRUE;<br>> +     else<br>> +             return FALSE;<br>>  }<br><br></div>And then:<br><br>       i_dest = malloc(sizeof(reachable_dest_t));<br>
       if (!i_dest)<br>               return -1;<br><br>, that's all.</blockquote>
<div> </div>
<div>I'm not following what you mean here.</div>
<div> </div>
<div>-- Hal</div>
<div> </div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><span></span><font color="#888888"><br>Sasha<br></font>
<div>
<div></div>
<div>_______________________________________________<br>general mailing list<br><a href="mailto:general@lists.openfabrics.org" target="_blank">general@lists.openfabrics.org</a><br><a href="http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general" target="_blank">http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general</a><br>
<br>To unsubscribe, please visit <a href="http://openib.org/mailman/listinfo/openib-general" target="_blank">http://openib.org/mailman/listinfo/openib-general</a><br></div></div></blockquote></div><br>