Convert glx/single2.c:DoGetString() to use asprintf()

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
Alan Coopersmith 2011-10-31 21:36:47 -07:00
parent f3cb512dc4
commit 71a89d9733

View File

@ -351,12 +351,10 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
} }
else if ( name == GL_VERSION ) { else if ( name == GL_VERSION ) {
if ( atof( string ) > atof( GLServerVersion ) ) { if ( atof( string ) > atof( GLServerVersion ) ) {
buf = malloc( strlen( string ) + strlen( GLServerVersion ) + 4 ); if ( asprintf( &buf, "%s (%s)", GLServerVersion, string ) == -1) {
if ( buf == NULL ) {
string = GLServerVersion; string = GLServerVersion;
} }
else { else {
sprintf( buf, "%s (%s)", GLServerVersion, string );
string = buf; string = buf;
} }
} }