def cstringObj(c_ptr): """The cstringObj function is a convenience function which creates a Python string copy, and discards the underlying C allocated storage for strings created with *alloc() functions in C. This function should not be invoked directly, only indirectly through the prototyping of the symbol 'cstring_obj'. """ if c_ptr is not None: python_string = ctypes.c_char_p( c_ptr ).value UTIL_LIB.free( c_ptr ) return python_string else: return None
def cstringObj(c_ptr): """The cstringObj function is a convenience function which creates a Python string copy, and discards the underlying C allocated storage for strings created with *alloc() functions in C. This function should not be invoked directly, only indirectly through the prototyping of the symbol 'cstring_obj'. """ if c_ptr is not None: python_string = ctypes.c_char_p(c_ptr).value UTIL_LIB.free(c_ptr) return python_string else: return None