I think
if ( char* space = strchr(name, ' ') )
name[space - name] = '\0';

is shorter and more readable, could you take it as well? (Or at least s/if (space > name)/if (space))