diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-05-07 17:49:47 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-05-07 17:49:47 +0200 |
commit | c3744b6736ce45c1c700b7f026fb0acfb0069a6d (patch) | |
tree | f92efb8a27043f24f2ef5d4a916f23a769634b15 /src/libw32dll/wine/win32.c | |
parent | 4527fd438b39dc312c69839f051e0a2ac0046356 (diff) | |
download | xine-lib-c3744b6736ce45c1c700b7f026fb0acfb0069a6d.tar.gz xine-lib-c3744b6736ce45c1c700b7f026fb0acfb0069a6d.tar.bz2 |
Use asprintf() rather than malloc() + sprintf().
Using asprintf() instead of malloc() + sprintf() reduces the lines of
code in xine-lib (moving the allocation to the C library or asprintf
replacement), makes it safer to access the string and can also improve
performance whenever the value returned by a function was used as
parameter, as before it had to run the function twice in almost every
case (once for strlen(), once for sprintf()).
Diffstat (limited to 'src/libw32dll/wine/win32.c')
-rw-r--r-- | src/libw32dll/wine/win32.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libw32dll/wine/win32.c b/src/libw32dll/wine/win32.c index 9b627a10a..f908f1c2e 100644 --- a/src/libw32dll/wine/win32.c +++ b/src/libw32dll/wine/win32.c @@ -3491,9 +3491,8 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2, if(strstr(cs1, ".qtx")) { int result; - char* tmp=(char*)malloc(strlen(win32_def_path)+250); char* x=strrchr(cs1,'\\'); - sprintf(tmp,"%s/%s",win32_def_path,x?(x+1):cs1); + asprintf(&tmp,"%s/%s",win32_def_path,x?(x+1):cs1); // printf("### Open: %s -> %s\n",cs1,tmp); result=open(tmp, O_RDONLY); free(tmp); |