# Path: pyczmq/_cffi.py
# C = ffi.dlopen('czmq')
# Z = ffi.dlopen('zmq')
# def ptop(typ, val):
# def cdef(decl, returns_string=False, nullable=False):
#     def wrap(f):
#         def inner_f(*args):


from pyczmq._cffi import C, ffi, ptop, cdef

cdef('typedef struct _zcert_t zcert_t;')


@cdef('void zcert_destroy (zcert_t **self_p);')
def destroy(cert):
    """Destroy a certificate in memory
    """
    C.zcert_destroy(ptop('zcert_t', cert))


@cdef('zcert_t * zcert_new (void);')
def new():
    """Create and initialize a new certificate in memory
    """

# Path: pyczmq/_cffi.py
# C = ffi.dlopen('czmq')
# Z = ffi.dlopen('zmq')
# def ptop(typ, val):
# def cdef(decl, returns_string=False, nullable=False):
#     def wrap(f):
#         def inner_f(*args):


# Path: pyczmq/zcert.py
from pyczmq._cffi import C, ffi, ptop, cdef


cdef('typedef struct _zcert_t zcert_t;')


@cdef('void zcert_destroy (zcert_t **self_p);')
def destroy(cert):
    """Destroy a certificate in memory
    """
    C.zcert_destroy(ptop('zcert_t', cert))


@cdef('zcert_t * zcert_new (void);')
def new():
    """Create and initialize a new certificate in memory
    """

    return ffi.gc(C.zcert_new(), destroy)