summaryrefslogtreecommitdiff
path: root/src/lib/evil
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2015-04-26 16:36:08 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-05-07 09:53:12 +0200
commitf2aec7ae4b04e039221ed7b1b8f7eb7e427447c8 (patch)
tree61c8993b221de3d9eb2a73569bfcf513b09db79b /src/lib/evil
parent45bba2439dc13a3bdf15f9323767d1ee6b51d938 (diff)
evil: minor formatting in dlfcn.c
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/evil')
-rw-r--r--src/lib/evil/dlfcn.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/lib/evil/dlfcn.c b/src/lib/evil/dlfcn.c
index fec541ec19..4efc91bcd8 100644
--- a/src/lib/evil/dlfcn.c
+++ b/src/lib/evil/dlfcn.c
@@ -22,13 +22,13 @@
22#include "dlfcn.h" 22#include "dlfcn.h"
23 23
24 24
25static char *dl_err = NULL; 25static char *_dl_err = NULL;
26static int dl_err_viewed = 0; 26static int _dl_err_viewed = 0;
27 27
28static void 28static void
29get_last_error(char *desc) 29_dl_get_last_error(char *desc)
30{ 30{
31 char *str; 31 char *str;
32 size_t l1; 32 size_t l1;
33 size_t l2; 33 size_t l2;
34 34
@@ -37,20 +37,20 @@ get_last_error(char *desc)
37 l1 = strlen(desc); 37 l1 = strlen(desc);
38 l2 = strlen(str); 38 l2 = strlen(str);
39 39
40 if (dl_err) 40 if (_dl_err)
41 free(dl_err); 41 free(_dl_err);
42 42
43 dl_err = (char *)malloc(sizeof(char) * (l1 + l2 + 1)); 43 _dl_err = (char *)malloc(sizeof(char) * (l1 + l2 + 1));
44 if (!dl_err) 44 if (!_dl_err)
45 dl_err = strdup("not enough resource"); 45 _dl_err = strdup("not enough resource");
46 else 46 else
47 { 47 {
48 memcpy(dl_err, desc, l1); 48 memcpy(_dl_err, desc, l1);
49 memcpy(dl_err + l1, str, l2); 49 memcpy(_dl_err + l1, str, l2);
50 dl_err[l1 + l2] = '\0'; 50 _dl_err[l1 + l2] = '\0';
51 } 51 }
52 free(str); 52 free(str);
53 dl_err_viewed = 0; 53 _dl_err_viewed = 0;
54} 54}
55 55
56void * 56void *
@@ -62,7 +62,7 @@ dlopen(const char* path, int mode EVIL_UNUSED)
62 { 62 {
63 module = GetModuleHandle(NULL); 63 module = GetModuleHandle(NULL);
64 if (!module) 64 if (!module)
65 get_last_error("GetModuleHandle returned: "); 65 _dl_get_last_error("GetModuleHandle returned: ");
66 } 66 }
67 else 67 else
68 { 68 {
@@ -75,10 +75,10 @@ dlopen(const char* path, int mode EVIL_UNUSED)
75 new_path = (char *)malloc(sizeof(char) * (l + 1)); 75 new_path = (char *)malloc(sizeof(char) * (l + 1));
76 if (!new_path) 76 if (!new_path)
77 { 77 {
78 if (dl_err) 78 if (_dl_err)
79 free(dl_err); 79 free(_dl_err);
80 dl_err = strdup("not enough resource"); 80 _dl_err = strdup("not enough resource");
81 dl_err_viewed = 0; 81 _dl_err_viewed = 0;
82 return NULL; 82 return NULL;
83 } 83 }
84 for (i = 0; i <= l; i++) 84 for (i = 0; i <= l; i++)
@@ -101,7 +101,7 @@ dlopen(const char* path, int mode EVIL_UNUSED)
101 LOAD_WITH_ALTERED_SEARCH_PATH); 101 LOAD_WITH_ALTERED_SEARCH_PATH);
102#endif /* ! UNICODE */ 102#endif /* ! UNICODE */
103 if (!module) 103 if (!module)
104 get_last_error("LoadLibraryEx returned: "); 104 _dl_get_last_error("LoadLibraryEx returned: ");
105 105
106 free(new_path); 106 free(new_path);
107 } 107 }
@@ -116,7 +116,7 @@ dlclose(void* handle)
116 return 0; 116 return 0;
117 else 117 else
118 { 118 {
119 get_last_error("FreeLibrary returned: "); 119 _dl_get_last_error("FreeLibrary returned: ");
120 return -1; 120 return -1;
121 } 121 }
122} 122}
@@ -146,7 +146,7 @@ dlsym(void *handle, const char *symbol)
146 modules, sizeof(modules), &needed)) 146 modules, sizeof(modules), &needed))
147 return NULL; 147 return NULL;
148 148
149 for (i = 0; i < (needed / sizeof(HMODULE)); i++) 149 for (i = 0; i < (needed / sizeof(HMODULE)); i++)
150 { 150 {
151 fp = GetProcAddress(modules[i], new_symbol); 151 fp = GetProcAddress(modules[i], new_symbol);
152 if (fp) break; 152 if (fp) break;
@@ -160,7 +160,7 @@ dlsym(void *handle, const char *symbol)
160#endif /* UNICODE */ 160#endif /* UNICODE */
161 161
162 if (!fp) 162 if (!fp)
163 get_last_error("GetProcAddress returned: "); 163 _dl_get_last_error("GetProcAddress returned: ");
164 164
165 return fp; 165 return fp;
166} 166}
@@ -221,15 +221,15 @@ dladdr (const void *addr EVIL_UNUSED, Dl_info *info)
221char * 221char *
222dlerror (void) 222dlerror (void)
223{ 223{
224 if (!dl_err_viewed) 224 if (!_dl_err_viewed)
225 { 225 {
226 dl_err_viewed = 1; 226 _dl_err_viewed = 1;
227 return dl_err; 227 return _dl_err;
228 } 228 }
229 else 229 else
230 { 230 {
231 if (dl_err) 231 if (_dl_err)
232 free(dl_err); 232 free(_dl_err);
233 return NULL; 233 return NULL;
234 } 234 }
235} 235}