diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/python/cffi/c/cdlopen.c | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/cffi/c/cdlopen.c')
-rw-r--r-- | contrib/python/cffi/c/cdlopen.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/contrib/python/cffi/c/cdlopen.c b/contrib/python/cffi/c/cdlopen.c index 9dc542590f..0ed319b8b5 100644 --- a/contrib/python/cffi/c/cdlopen.c +++ b/contrib/python/cffi/c/cdlopen.c @@ -1,7 +1,7 @@ /* ffi.dlopen() interface with dlopen()/dlsym()/dlclose() */ -static void *cdlopen_fetch(PyObject *libname, void *libhandle, - const char *symbol) +static void *cdlopen_fetch(PyObject *libname, void *libhandle, + const char *symbol) { void *address; @@ -40,19 +40,19 @@ static int cdlopen_close(PyObject *libname, void *libhandle) static PyObject *ffi_dlopen(PyObject *self, PyObject *args) { - const char *modname; - PyObject *temp, *result = NULL; + const char *modname; + PyObject *temp, *result = NULL; void *handle; - int auto_close; + int auto_close; - handle = b_do_dlopen(args, &modname, &temp, &auto_close); - if (handle != NULL) - { - result = (PyObject *)lib_internal_new((FFIObject *)self, - modname, handle, auto_close); + handle = b_do_dlopen(args, &modname, &temp, &auto_close); + if (handle != NULL) + { + result = (PyObject *)lib_internal_new((FFIObject *)self, + modname, handle, auto_close); } - Py_XDECREF(temp); - return result; + Py_XDECREF(temp); + return result; } static PyObject *ffi_dlclose(PyObject *self, PyObject *args) @@ -63,16 +63,16 @@ static PyObject *ffi_dlclose(PyObject *self, PyObject *args) return NULL; libhandle = lib->l_libhandle; - if (libhandle != NULL) - { - lib->l_libhandle = NULL; - - /* Clear the dict to force further accesses to do cdlopen_fetch() - again, and fail because the library was closed. */ - PyDict_Clear(lib->l_dict); - - if (cdlopen_close(lib->l_libname, libhandle) < 0) - return NULL; + if (libhandle != NULL) + { + lib->l_libhandle = NULL; + + /* Clear the dict to force further accesses to do cdlopen_fetch() + again, and fail because the library was closed. */ + PyDict_Clear(lib->l_dict); + + if (cdlopen_close(lib->l_libname, libhandle) < 0) + return NULL; } Py_INCREF(Py_None); return Py_None; |