opensm/osm_torus.c: Consolidate some parsing with parse_unsigned
PATCH 1/3 opensm/osm_torus.c: Consolidate some parsing with parse_unsigned
Signed-off-by Jim Schutt <[email protected]>
---
opensm/osm_torus.c +4 -16
@@ -853,14 +853,14 @@ out: }static -bool parse_port (unsigned *pnum,const char *parse_sep) +bool parse_unsigned (unsigned *result,const char *parse_sep) {char *val, *nextchar; val =strtok (NULL , parse_sep);if (!val)return false; - *pnum =strtoul (val, &nextchar,0 ); + *result =strtoul (val, &nextchar,0 );return true; }
@@ -870,7 +870,7 @@ bool parse_port_order(struct torus *t, unsigned port_order[], const char *parse_unsigned i, j, k, n;for (i =0 ; i <ARRAY_SIZE (port_order); i++) { -if (!parse_port (&(port_order[i]), parse_sep)) +if (!parse_unsigned (&(port_order[i]), parse_sep))break ;for (j =0 ; j < i; j++) {
@@ -898,18 +898,6 @@ bool parse_port_order(struct torus *t, unsigned port_order[], const char *parse_ }static -bool parse_pg_max_ports (struct torus *t,const char *parse_sep) -{ -char *val, *nextchar; - - val =strtok (NULL , parse_sep); -if (!val) -return false; - t->portgrp_sz =strtoul (val, &nextchar,0 ); -return true; -} - -static bool parse_guid (struct torus *t,guid_t *guid,const char *parse_sep) {char *val;
@@ -1094,7 +1082,7 @@ next_line: kw_success =grow_seed_array (t,1 ); t->seed_cnt++; }else if (strcmp ("portgroup_max_ports" , keyword) ==0 ) { - kw_success =parse_pg_max_ports (t, parse_sep); + kw_success =parse_unsigned (&t->portgrp_sz, parse_sep); }else if (strcmp ("xp_link" , keyword) ==0 ) {if (!t->seed_cnt) t->seed_cnt++;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 50EB26FF.5080507-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
Hi Hal,
Quoted 4 lines · Hal Rosenstock
Signed-off-by Jim Schutt <[email protected]>---
Applied the series. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html