]> sigrok.org Git - libsigrokdecode.git/commitdiff
libsigrokdecode: Use SIGROKDECODE_OK.
authorUwe Hermann <redacted>
Fri, 14 May 2010 10:50:01 +0000 (12:50 +0200)
committerUwe Hermann <redacted>
Thu, 20 May 2010 21:41:33 +0000 (23:41 +0200)
decode.c

index e6399db72ce346bf6d2dfc4e378a11ac0a2bcb4e..1b12c9ee33644f853712a333ff1185db1edf2969 100644 (file)
--- a/decode.c
+++ b/decode.c
@@ -25,7 +25,7 @@
 /**
  * Initialize libsigrokdecode.
  *
 /**
  * Initialize libsigrokdecode.
  *
- * @return 0 upon success, non-zero otherwise.
+ * @return SIGROKDECODE_OK upon success, a (negative) error code otherwise.
  */
 int sigrokdecode_init(void)
 {
  */
 int sigrokdecode_init(void)
 {
@@ -34,6 +34,7 @@ int sigrokdecode_init(void)
 
        /* Add some more search directories for convenience. */
        /* FIXME: Check error code. */
 
        /* Add some more search directories for convenience. */
        /* FIXME: Check error code. */
+       /* FIXME: What happens if this function is called multiple times? */
        PyRun_SimpleString(
                "import sys;"
                "sys.path.append('libsigrokdecode/scripts');"
        PyRun_SimpleString(
                "import sys;"
                "sys.path.append('libsigrokdecode/scripts');"
@@ -41,7 +42,7 @@ int sigrokdecode_init(void)
                "sys.path.append('/usr/local/share/sigrok');"
                );
 
                "sys.path.append('/usr/local/share/sigrok');"
                );
 
-       return 0;
+       return SIGROKDECODE_OK;
 }
 
 /**
 }
 
 /**
@@ -49,8 +50,8 @@ int sigrokdecode_init(void)
  *
  * TODO: @param entries.
  *
  *
  * TODO: @param entries.
  *
- * @return 0 upon success, non-zero otherwise. The 'outstr' argument will
- *         point to a malloc()ed string upon success.
+ * @return LIBSIGROKDECODE_OK upon success, a (negative) error code otherwise.
+ *         The 'outstr' argument points to a malloc()ed string upon success.
  */
 static int h_str(PyObject *py_res, PyObject *py_func, PyObject *py_mod,
                 const char *key, char **outstr)
  */
 static int h_str(PyObject *py_res, PyObject *py_func, PyObject *py_mod,
                 const char *key, char **outstr)
@@ -87,14 +88,15 @@ static int h_str(PyObject *py_res, PyObject *py_func, PyObject *py_mod,
 
        Py_DECREF(py_str);
 
 
        Py_DECREF(py_str);
 
-       return 0;
+       return SIGROKDECODE_OK;
 }
 
 /**
  * TODO
  *
  * @param name TODO
 }
 
 /**
  * TODO
  *
  * @param name TODO
- * @return 0 upon success, non-zero otherwise.
+ *
+ * @return LIBSIGROKDECODE_OK upon success, a (negative) error code otherwise.
  */
 int sigrokdecode_load_decoder(const char *name,
                              struct sigrokdecode_decoder **dec)
  */
 int sigrokdecode_load_decoder(const char *name,
                              struct sigrokdecode_decoder **dec)
@@ -166,7 +168,7 @@ int sigrokdecode_load_decoder(const char *name,
 
        *dec = d;
 
 
        *dec = d;
 
-       return 0;
+       return SIGROKDECODE_OK;
 }
 
 /**
 }
 
 /**
@@ -177,7 +179,8 @@ int sigrokdecode_load_decoder(const char *name,
  * @param inbuflen TODO
  * @param outbuf TODO
  * @param outbuflen TODO
  * @param inbuflen TODO
  * @param outbuf TODO
  * @param outbuflen TODO
- * @return 0 upon success, non-zero otherwise.
+ *
+ * @return LIBSIGROKDECODE_OK upon success, a (negative) error code otherwise.
  */
 int sigrokdecode_run_decoder(struct sigrokdecode_decoder *dec,
                             uint8_t *inbuf, uint64_t inbuflen,
  */
 int sigrokdecode_run_decoder(struct sigrokdecode_decoder *dec,
                             uint8_t *inbuf, uint64_t inbuflen,
@@ -259,18 +262,18 @@ int sigrokdecode_run_decoder(struct sigrokdecode_decoder *dec,
        Py_DECREF(py_func);
        Py_DECREF(py_mod);
 
        Py_DECREF(py_func);
        Py_DECREF(py_mod);
 
-       return 0;
+       return SIGROKDECODE_OK;
 }
 
 /**
  * Shutdown libsigrokdecode.
  *
 }
 
 /**
  * Shutdown libsigrokdecode.
  *
- * @return 0 upon success, non-zero otherwise.
+ * @return LIBSIGROKDECODE_OK upon success, a (negative) error code otherwise.
  */
 int sigrokdecode_shutdown(void)
 {
        /* Py_Finalize() returns void, any finalization errors are ignored. */
        Py_Finalize();
 
  */
 int sigrokdecode_shutdown(void)
 {
        /* Py_Finalize() returns void, any finalization errors are ignored. */
        Py_Finalize();
 
-       return 0;
+       return SIGROKDECODE_OK;
 }
 }