LCOV - code coverage report
Current view: top level - Modules - common.c (source / functions) Hit Total Coverage
Test: python-ldap LCOV report Lines: 9 9 100.0 %
Date: 2017-12-08 13:03:20 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /* Miscellaneous common routines
       2             :  * See https://www.python-ldap.org/ for details. */
       3             : 
       4             : #include "common.h"
       5             : 
       6             : /* dynamically add the methods into the module dictionary d */
       7             : 
       8             : void
       9           2 : LDAPadd_methods( PyObject* d, PyMethodDef* methods ) 
      10             : {
      11             :     PyMethodDef *meth;
      12             : 
      13          10 :     for( meth = methods; meth->ml_meth; meth++ ) {
      14           8 :         PyObject *f = PyCFunction_New( meth, NULL );
      15           8 :         PyDict_SetItemString( d, meth->ml_name, f );
      16           8 :         Py_DECREF(f);
      17             :     }
      18           2 : }
      19             : 
      20             : /* Raise TypeError with custom message and object */
      21             : PyObject*
      22          38 : LDAPerror_TypeError(const char *msg, PyObject *obj) {
      23             : #ifdef DEMO_LEAK
      24          38 :     PyErr_SetObject(PyExc_TypeError, Py_BuildValue("sO", msg, obj));
      25          38 :     return NULL;
      26             : #else
      27             :     PyObject *args = Py_BuildValue("sO", msg, obj);
      28             :     if (args == NULL) {
      29             :         return NULL;
      30             :     }
      31             :     PyErr_SetObject(PyExc_TypeError, args);
      32             :     Py_DECREF(args);
      33             :     return NULL;
      34             : #endif
      35             : }

Generated by: LCOV version 1.12