diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2021-02-03 20:57:40 +0100 |
---|---|---|
committer | Pali Rohár <pali.rohar@gmail.com> | 2021-02-03 20:57:40 +0100 |
commit | f7e7a5d7345cb416c5514b983f2d8ad387b6f915 (patch) | |
tree | 50931eb5994f937c672015b4978765a8039adb13 /src | |
parent | 3ec513f9d9fec0cf52aa7e2f2050112499cac581 (diff) | |
download | dlfcn-win32-f7e7a5d7345cb416c5514b983f2d8ad387b6f915.tar.gz dlfcn-win32-f7e7a5d7345cb416c5514b983f2d8ad387b6f915.tar.bz2 dlfcn-win32-f7e7a5d7345cb416c5514b983f2d8ad387b6f915.zip |
Fix some style issues
Diffstat (limited to 'src')
-rw-r--r-- | src/dlfcn.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/dlfcn.c b/src/dlfcn.c index abbd58d..9620692 100644 --- a/src/dlfcn.c +++ b/src/dlfcn.c | |||
@@ -38,11 +38,11 @@ | |||
38 | 38 | ||
39 | #ifdef _MSC_VER | 39 | #ifdef _MSC_VER |
40 | /* https://docs.microsoft.com/en-us/cpp/intrinsics/returnaddress */ | 40 | /* https://docs.microsoft.com/en-us/cpp/intrinsics/returnaddress */ |
41 | #pragma intrinsic(_ReturnAddress) | 41 | #pragma intrinsic( _ReturnAddress ) |
42 | #else | 42 | #else |
43 | /* https://gcc.gnu.org/onlinedocs/gcc/Return-Address.html */ | 43 | /* https://gcc.gnu.org/onlinedocs/gcc/Return-Address.html */ |
44 | #ifndef _ReturnAddress | 44 | #ifndef _ReturnAddress |
45 | #define _ReturnAddress() (__builtin_extract_return_addr(__builtin_return_address(0))) | 45 | #define _ReturnAddress( ) ( __builtin_extract_return_addr( __builtin_return_address( 0 ) ) ) |
46 | #endif | 46 | #endif |
47 | #endif | 47 | #endif |
48 | 48 | ||
@@ -90,12 +90,12 @@ static BOOL local_add( HMODULE hModule ) | |||
90 | pobject = local_search( hModule ); | 90 | pobject = local_search( hModule ); |
91 | 91 | ||
92 | /* Do not add object again if it's already on the list */ | 92 | /* Do not add object again if it's already on the list */ |
93 | if( pobject ) | 93 | if( pobject != NULL ) |
94 | return TRUE; | 94 | return TRUE; |
95 | 95 | ||
96 | for( pobject = &first_object; pobject->next; pobject = pobject->next ); | 96 | for( pobject = &first_object; pobject->next; pobject = pobject->next ); |
97 | 97 | ||
98 | nobject = (local_object*) malloc( sizeof( local_object ) ); | 98 | nobject = (local_object *) malloc( sizeof( local_object ) ); |
99 | 99 | ||
100 | if( !nobject ) | 100 | if( !nobject ) |
101 | { | 101 | { |
@@ -120,7 +120,7 @@ static void local_rem( HMODULE hModule ) | |||
120 | 120 | ||
121 | pobject = local_search( hModule ); | 121 | pobject = local_search( hModule ); |
122 | 122 | ||
123 | if( !pobject ) | 123 | if( pobject == NULL ) |
124 | return; | 124 | return; |
125 | 125 | ||
126 | if( pobject->next ) | 126 | if( pobject->next ) |
@@ -159,7 +159,7 @@ static void save_err_str( const char *str ) | |||
159 | */ | 159 | */ |
160 | pos = 0; | 160 | pos = 0; |
161 | error_buffer[pos++] = '"'; | 161 | error_buffer[pos++] = '"'; |
162 | memcpy( error_buffer+pos, str, len ); | 162 | memcpy( error_buffer + pos, str, len ); |
163 | pos += len; | 163 | pos += len; |
164 | error_buffer[pos++] = '"'; | 164 | error_buffer[pos++] = '"'; |
165 | error_buffer[pos++] = ':'; | 165 | error_buffer[pos++] = ':'; |
@@ -167,7 +167,7 @@ static void save_err_str( const char *str ) | |||
167 | 167 | ||
168 | ret = FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwMessageId, | 168 | ret = FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwMessageId, |
169 | MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), | 169 | MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), |
170 | error_buffer+pos, (DWORD) (sizeof(error_buffer)-pos), NULL ); | 170 | error_buffer + pos, (DWORD) ( sizeof( error_buffer ) - pos ), NULL ); |
171 | pos += ret; | 171 | pos += ret; |
172 | 172 | ||
173 | /* When FormatMessageA() fails it returns zero and does not touch buffer | 173 | /* When FormatMessageA() fails it returns zero and does not touch buffer |
@@ -197,7 +197,7 @@ static void save_err_ptr_str( const void *ptr ) | |||
197 | for( i = 0; i < 2 * sizeof( ptr ); i++ ) | 197 | for( i = 0; i < 2 * sizeof( ptr ); i++ ) |
198 | { | 198 | { |
199 | num = ( ( (ULONG_PTR) ptr ) >> ( 8 * sizeof( ptr ) - 4 * ( i + 1 ) ) ) & 0xF; | 199 | num = ( ( (ULONG_PTR) ptr ) >> ( 8 * sizeof( ptr ) - 4 * ( i + 1 ) ) ) & 0xF; |
200 | ptr_buf[2+i] = num + ( ( num < 0xA ) ? '0' : ( 'A' - 0xA ) ); | 200 | ptr_buf[2 + i] = num + ( ( num < 0xA ) ? '0' : ( 'A' - 0xA ) ); |
201 | } | 201 | } |
202 | 202 | ||
203 | ptr_buf[2 + 2 * sizeof( ptr )] = 0; | 203 | ptr_buf[2 + 2 * sizeof( ptr )] = 0; |
@@ -234,9 +234,9 @@ void *dlopen( const char *file, int mode ) | |||
234 | /* Do not let Windows display the critical-error-handler message box */ | 234 | /* Do not let Windows display the critical-error-handler message box */ |
235 | uMode = SetErrorMode( SEM_FAILCRITICALERRORS ); | 235 | uMode = SetErrorMode( SEM_FAILCRITICALERRORS ); |
236 | 236 | ||
237 | if( file == 0 ) | 237 | if( file == NULL ) |
238 | { | 238 | { |
239 | /* POSIX says that if the value of file is 0, a handle on a global | 239 | /* POSIX says that if the value of file is NULL, a handle on a global |
240 | * symbol object must be provided. That object must be able to access | 240 | * symbol object must be provided. That object must be able to access |
241 | * all symbols from the original program file, and any objects loaded | 241 | * all symbols from the original program file, and any objects loaded |
242 | * with the RTLD_GLOBAL flag. | 242 | * with the RTLD_GLOBAL flag. |