[openib-general] [PATCH] OpenSM: Change filename from subnet.lst to osm-subnet.lst
Hal Rosenstock
halr at voltaire.com
Tue Nov 28 17:41:26 PST 2006
On Tue, 2006-11-28 at 19:25, Greg Lindahl wrote:
> On Tue, Nov 28, 2006 at 07:02:07AM -0500, Hal Rosenstock wrote:
>
> > file_name =
> > - ( char * )malloc( strlen( p_mgr->p_subn->opt.dump_files_dir ) + 12 );
> > + ( char * )malloc( strlen( p_mgr->p_subn->opt.dump_files_dir ) + 16 );
> >
> > CL_ASSERT( file_name );
> >
> > strcpy( file_name, p_mgr->p_subn->opt.dump_files_dir );
> > - strcat( file_name, "/subnet.lst" );
> > + strcat( file_name, "/osm-subnet.lst" );
>
> Instead of changing the magic number 12 to a different magic number, how about,
>
> #define SUBNET_LIST_FILENAME "/osm-subnet.lst"
>
> file_name =
> (char *)malloc(strlen(p_mgr->p_subn->opt.dump_files_dir) + strlen(SUBNET_LIST_FILENAME) + 1);
> ...
> strcat(file_name, SUBNET_LIST_FILENAME);
>
> Voila! No more magic number. Well, other than the 1 for the \0.
Sure; that's an improvement. I'll reissue the patch and also look for
other places in OpenSM like this.
-- Hal
> -- greg
>
>
> _______________________________________________
> openib-general mailing list
> openib-general at openib.org
> http://openib.org/mailman/listinfo/openib-general
>
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
>
More information about the general
mailing list