From 55c3c5f4b9d38b85fae2c39a8a6150b4c50b1bdb Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Thu, 9 Feb 2012 19:11:53 +0100 Subject: [PATCH] srd: Add/use SRD_API/SRD_PRIV macros. This is not yet finished, more things should be made private. --- controller.c | 59 ++++++++++----------- decoder.c | 19 ++++--- exception.c | 2 +- log.c | 24 ++++----- module_sigrokdecode.c | 8 +-- sigrokdecode-internal.h | 13 ++--- sigrokdecode.h | 111 ++++++++++++++++++++++++---------------- type_decoder.c | 2 +- type_logic.c | 6 +-- util.c | 9 ++-- 10 files changed, 138 insertions(+), 115 deletions(-) diff --git a/controller.c b/controller.c index 15001ed..476f4f3 100644 --- a/controller.c +++ b/controller.c @@ -32,13 +32,13 @@ static GSList *di_list = NULL; static GSList *callbacks = NULL; /* decoder.c */ -extern GSList *pd_list; +extern SRD_PRIV GSList *pd_list; /* module_sigrokdecode.c */ -extern PyMODINIT_FUNC PyInit_sigrokdecode(void); +extern SRD_PRIV PyMODINIT_FUNC PyInit_sigrokdecode(void); /* type_logic.c */ -extern PyTypeObject srd_logic_type; +extern SRD_PRIV PyTypeObject srd_logic_type; /** * Initialize libsigrokdecode. @@ -62,7 +62,7 @@ extern PyTypeObject srd_logic_type; * directory cannot be accessed, return SRD_ERR_DECODERS_DIR. * If not enough memory could be allocated, return SRD_ERR_MALLOC. */ -int srd_init(void) +SRD_API int srd_init(void) { int ret; @@ -99,7 +99,7 @@ int srd_init(void) * * @return SRD_OK upon success, a (negative) error code otherwise. */ -int srd_exit(void) +SRD_API int srd_exit(void) { srd_dbg("Exiting libsigrokdecode."); @@ -127,7 +127,7 @@ int srd_exit(void) * * @return TODO. */ -int set_modulepath(void) +SRD_API int set_modulepath(void) { int ret; gchar *path, *s; @@ -168,8 +168,8 @@ int set_modulepath(void) * * @return SRD_OK upon success, a (negative) error code otherwise. */ -int srd_instance_set_options(struct srd_decoder_instance *di, - GHashTable * options) +SRD_API int srd_instance_set_options(struct srd_decoder_instance *di, + GHashTable *options) { PyObject *py_dec_options, *py_dec_optkeys, *py_di_options, *py_optval; PyObject *py_optlist, *py_classval; @@ -291,8 +291,8 @@ static gint compare_probe_id(struct srd_probe *a, char *probe_id) * arranged in this order. * @return SRD_OK upon success, a (negative) error code otherwise. */ -int srd_instance_set_probes(struct srd_decoder_instance *di, - GHashTable * new_probes) +SRD_API int srd_instance_set_probes(struct srd_decoder_instance *di, + GHashTable *new_probes) { GList *l; GSList *sl; @@ -363,8 +363,8 @@ int srd_instance_set_probes(struct srd_decoder_instance *di, * @return Pointer to a newly allocated struct srd_decoder_instance, or * NULL in case of failure. */ -struct srd_decoder_instance *srd_instance_new(const char *decoder_id, - GHashTable *options) +SRD_API struct srd_decoder_instance *srd_instance_new(const char *decoder_id, + GHashTable *options) { int i; struct srd_decoder *dec; @@ -426,8 +426,8 @@ struct srd_decoder_instance *srd_instance_new(const char *decoder_id, return di; } -int srd_instance_stack(struct srd_decoder_instance *di_from, - struct srd_decoder_instance *di_to) +SRD_API int srd_instance_stack(struct srd_decoder_instance *di_from, + struct srd_decoder_instance *di_to) { if (!di_from || !di_to) { srd_err("Invalid from/to instance pair."); @@ -454,7 +454,7 @@ int srd_instance_stack(struct srd_decoder_instance *di_from, * * @return Pointer to struct srd_decoder_instance, or NULL if not found. */ -struct srd_decoder_instance *srd_instance_find_by_id(char *instance_id) +SRD_API struct srd_decoder_instance *srd_instance_find_by_id(char *instance_id) { GSList *l; struct srd_decoder_instance *tmp, *di; @@ -483,8 +483,8 @@ struct srd_decoder_instance *srd_instance_find_by_id(char *instance_id) * * @return Pointer to struct srd_decoder_instance, or NULL if not found. */ -struct srd_decoder_instance *srd_instance_find_by_obj(GSList *stack, - PyObject *obj) +SRD_API struct srd_decoder_instance *srd_instance_find_by_obj(GSList *stack, + PyObject *obj) { GSList *l; struct srd_decoder_instance *tmp, *di; @@ -501,7 +501,7 @@ struct srd_decoder_instance *srd_instance_find_by_obj(GSList *stack, return di; } -int srd_instance_start(struct srd_decoder_instance *di, PyObject *args) +SRD_API int srd_instance_start(struct srd_decoder_instance *di, PyObject *args) { PyObject *py_name, *py_res; GSList *l; @@ -550,9 +550,9 @@ int srd_instance_start(struct srd_decoder_instance *di, PyObject *args) * * @return SRD_OK upon success, a (negative) error code otherwise. */ -int srd_instance_decode(uint64_t start_samplenum, - struct srd_decoder_instance *di, uint8_t *inbuf, - uint64_t inbuflen) +SRD_API int srd_instance_decode(uint64_t start_samplenum, + struct srd_decoder_instance *di, + uint8_t *inbuf, uint64_t inbuflen) { PyObject *py_res; srd_logic *logic; @@ -602,7 +602,7 @@ int srd_instance_decode(uint64_t start_samplenum, return SRD_OK; } -void srd_instance_free(struct srd_decoder_instance *di) +SRD_API void srd_instance_free(struct srd_decoder_instance *di) { GSList *l; struct srd_pd_output *pdo; @@ -621,7 +621,7 @@ void srd_instance_free(struct srd_decoder_instance *di) g_slist_free(di->pd_output); } -void srd_instance_free_all(GSList *stack) +SRD_API void srd_instance_free_all(GSList *stack) { GSList *l; struct srd_decoder_instance *di; @@ -639,7 +639,7 @@ void srd_instance_free_all(GSList *stack) } } -int srd_session_start(int num_probes, int unitsize, uint64_t samplerate) +SRD_API int srd_session_start(int num_probes, int unitsize, uint64_t samplerate) { PyObject *args; GSList *d; @@ -673,8 +673,8 @@ int srd_session_start(int num_probes, int unitsize, uint64_t samplerate) } /* Feed logic samples to decoder session. */ -int srd_session_feed(uint64_t start_samplenum, uint8_t * inbuf, - uint64_t inbuflen) +SRD_API int srd_session_feed(uint64_t start_samplenum, uint8_t * inbuf, + uint64_t inbuflen) { GSList *d; int ret; @@ -692,7 +692,7 @@ int srd_session_feed(uint64_t start_samplenum, uint8_t * inbuf, return SRD_OK; } -int srd_register_callback(int output_type, srd_pd_output_callback_t cb) +SRD_API int srd_register_callback(int output_type, srd_pd_output_callback_t cb) { struct srd_pd_callback *pd_cb; @@ -708,7 +708,7 @@ int srd_register_callback(int output_type, srd_pd_output_callback_t cb) return SRD_OK; } -void *srd_find_callback(int output_type) +SRD_API void *srd_find_callback(int output_type) { GSList *l; struct srd_pd_callback *pd_cb; @@ -727,7 +727,8 @@ void *srd_find_callback(int output_type) } /* This is the backend function to python sigrokdecode.add() call. */ -int pd_add(struct srd_decoder_instance *di, int output_type, char *proto_id) +SRD_PRIV int pd_add(struct srd_decoder_instance *di, int output_type, + char *proto_id) { struct srd_pd_output *pdo; diff --git a/decoder.c b/decoder.c index e039e37..557aa71 100644 --- a/decoder.c +++ b/decoder.c @@ -24,10 +24,10 @@ #include /* The list of protocol decoders. */ -GSList *pd_list = NULL; +SRD_PRIV GSList *pd_list = NULL; /* module_sigrokdecode.c */ -extern PyObject *mod_sigrokdecode; +extern SRD_PRIV PyObject *mod_sigrokdecode; /** * Returns the list of supported/loaded protocol decoders. @@ -36,7 +36,7 @@ extern PyObject *mod_sigrokdecode; * * @return List of decoders, NULL if none are supported or loaded. */ -GSList *srd_list_decoders(void) +SRD_API GSList *srd_list_decoders(void) { return pd_list; } @@ -47,7 +47,7 @@ GSList *srd_list_decoders(void) * @param id The ID string of the decoder to return. * @return The decoder with the specified ID, or NULL if not found. */ -struct srd_decoder *srd_get_decoder_by_id(const char *id) +SRD_API struct srd_decoder *srd_get_decoder_by_id(const char *id) { GSList *l; struct srd_decoder *dec; @@ -126,7 +126,7 @@ err_out: * * @return SRD_OK upon success, a (negative) error code otherwise. */ -int srd_load_decoder(const char *name, struct srd_decoder **dec) +SRD_API int srd_load_decoder(const char *name, struct srd_decoder **dec) { PyObject *py_basedec, *py_method, *py_attr, *py_annlist, *py_ann; struct srd_decoder *d; @@ -280,7 +280,7 @@ err_out: return ret; } -char *srd_decoder_doc(struct srd_decoder *dec) +SRD_API char *srd_decoder_doc(struct srd_decoder *dec) { PyObject *py_str; char *doc; @@ -327,9 +327,8 @@ static void free_probes(GSList *probelist) * * @return SRD_OK upon success, a (negative) error code otherwise. */ -int srd_unload_decoder(struct srd_decoder *dec) +SRD_API int srd_unload_decoder(struct srd_decoder *dec) { - srd_dbg("unloading decoder %s", dec->name); /* Since any instances of this decoder need to be released as well, @@ -362,7 +361,7 @@ int srd_unload_decoder(struct srd_decoder *dec) return SRD_OK; } -int srd_load_all_decoders(void) +SRD_API int srd_load_all_decoders(void) { GDir *dir; GError *error; @@ -392,7 +391,7 @@ int srd_load_all_decoders(void) /** * TODO */ -int srd_unload_all_decoders(void) +SRD_API int srd_unload_all_decoders(void) { GSList *l; struct srd_decoder *dec; diff --git a/exception.c b/exception.c index a67600f..1f30c80 100644 --- a/exception.c +++ b/exception.c @@ -24,7 +24,7 @@ #include #include /* Python header not pulled in by default. */ -void catch_exception(const char *format, ...) +SRD_PRIV void catch_exception(const char *format, ...) { PyObject *etype, *evalue, *etb, *py_str; PyTracebackObject *py_tb; diff --git a/log.c b/log.c index a5e590b..97fde91 100644 --- a/log.c +++ b/log.c @@ -58,7 +58,7 @@ static char srd_log_domain[LOGDOMAIN_MAXLEN + 1] = LOGDOMAIN_DEFAULT; * SRD_LOG_WARN, SRD_LOG_INFO, SRD_LOG_DBG, or SRD_LOG_SPEW). * @return SRD_OK upon success, SRD_ERR_ARG upon invalid loglevel. */ -int srd_log_loglevel_set(int loglevel) +SRD_API int srd_log_loglevel_set(int loglevel) { if (loglevel < SRD_LOG_NONE || loglevel > SRD_LOG_SPEW) { srd_err("Invalid loglevel %d.", loglevel); @@ -77,7 +77,7 @@ int srd_log_loglevel_set(int loglevel) * * @return The currently configured libsigrokdecode loglevel. */ -int srd_log_loglevel_get(void) +SRD_API int srd_log_loglevel_get(void) { return srd_loglevel; } @@ -95,7 +95,7 @@ int srd_log_loglevel_get(void) * the caller does not need to keep it around. * @return SRD_OK upon success, SRD_ERR_ARG upon invalid logdomain. */ -int srd_log_logdomain_set(const char *logdomain) +SRD_API int srd_log_logdomain_set(const char *logdomain) { if (!logdomain) { srd_err("log: %s: logdomain was NULL", __func__); @@ -117,7 +117,7 @@ int srd_log_logdomain_set(const char *logdomain) * string. The caller is responsible for g_free()ing the string when * it is no longer needed. */ -char *srd_log_logdomain_get(void) +SRD_API char *srd_log_logdomain_get(void) { return g_strdup((const char *)&srd_log_domain); } @@ -134,7 +134,7 @@ char *srd_log_logdomain_get(void) * to be NULL if the caller doesn't need/want to pass any data. * @return SRD_OK upon success, SRD_ERR_ARG upon invalid arguments. */ -int srd_log_handler_set(srd_log_handler_t handler, void *data) +SRD_API int srd_log_handler_set(srd_log_handler_t handler, void *data) { if (!handler) { srd_err("log: %s: handler was NULL", __func__); @@ -156,7 +156,7 @@ int srd_log_handler_set(srd_log_handler_t handler, void *data) * * @return SRD_OK upon success, a negative error code otherwise. */ -int srd_log_handler_set_default(void) +SRD_API int srd_log_handler_set_default(void) { /* * Note: No log output in this function, as it should safely work @@ -187,7 +187,7 @@ static int srd_logv(void *data, int loglevel, const char *format, va_list args) return ret; } -int srd_log(int loglevel, const char *format, ...) +SRD_PRIV int srd_log(int loglevel, const char *format, ...) { int ret; va_list args; @@ -199,7 +199,7 @@ int srd_log(int loglevel, const char *format, ...) return ret; } -int srd_spew(const char *format, ...) +SRD_PRIV int srd_spew(const char *format, ...) { int ret; va_list args; @@ -211,7 +211,7 @@ int srd_spew(const char *format, ...) return ret; } -int srd_dbg(const char *format, ...) +SRD_PRIV int srd_dbg(const char *format, ...) { int ret; va_list args; @@ -223,7 +223,7 @@ int srd_dbg(const char *format, ...) return ret; } -int srd_info(const char *format, ...) +SRD_PRIV int srd_info(const char *format, ...) { int ret; va_list args; @@ -235,7 +235,7 @@ int srd_info(const char *format, ...) return ret; } -int srd_warn(const char *format, ...) +SRD_PRIV int srd_warn(const char *format, ...) { int ret; va_list args; @@ -247,7 +247,7 @@ int srd_warn(const char *format, ...) return ret; } -int srd_err(const char *format, ...) +SRD_PRIV int srd_err(const char *format, ...) { int ret; va_list args; diff --git a/module_sigrokdecode.c b/module_sigrokdecode.c index 0992ea2..1cbcc40 100644 --- a/module_sigrokdecode.c +++ b/module_sigrokdecode.c @@ -22,16 +22,16 @@ #include "config.h" /* type_decoder.c */ -extern PyTypeObject srd_Decoder_type; +extern SRD_PRIV PyTypeObject srd_Decoder_type; /* type_logic.c */ -extern PyTypeObject srd_logic_type; +extern SRD_PRIV PyTypeObject srd_logic_type; /* * When initialized, a reference to this module inside the python interpreter * lives here. */ -PyObject *mod_sigrokdecode = NULL; +SRD_PRIV PyObject *mod_sigrokdecode = NULL; static struct PyModuleDef sigrokdecode_module = { PyModuleDef_HEAD_INIT, @@ -40,7 +40,7 @@ static struct PyModuleDef sigrokdecode_module = { .m_size = -1, }; -PyMODINIT_FUNC PyInit_sigrokdecode(void) +SRD_PRIV PyMODINIT_FUNC PyInit_sigrokdecode(void) { PyObject *mod; diff --git a/sigrokdecode-internal.h b/sigrokdecode-internal.h index 5ff080b..86a77e4 100644 --- a/sigrokdecode-internal.h +++ b/sigrokdecode-internal.h @@ -21,6 +21,7 @@ #ifndef LIBSIGROKDECODE_SIGROKDECODE_INTERNAL_H #define LIBSIGROKDECODE_SIGROKDECODE_INTERNAL_H +#include "sigrokdecode.h" // #include // #include @@ -36,11 +37,11 @@ /*--- log.c -----------------------------------------------------------------*/ -int srd_log(int loglevel, const char *format, ...); -int srd_spew(const char *format, ...); -int srd_dbg(const char *format, ...); -int srd_info(const char *format, ...); -int srd_warn(const char *format, ...); -int srd_err(const char *format, ...); +SRD_PRIV int srd_log(int loglevel, const char *format, ...); +SRD_PRIV int srd_spew(const char *format, ...); +SRD_PRIV int srd_dbg(const char *format, ...); +SRD_PRIV int srd_info(const char *format, ...); +SRD_PRIV int srd_warn(const char *format, ...); +SRD_PRIV int srd_err(const char *format, ...); #endif diff --git a/sigrokdecode.h b/sigrokdecode.h index 51efcc6..69fc2ce 100644 --- a/sigrokdecode.h +++ b/sigrokdecode.h @@ -63,6 +63,25 @@ extern "C" { #define SRD_LOG_DBG 4 /**< Output debug messages. */ #define SRD_LOG_SPEW 5 /**< Output very noisy debug messages. */ +/* + * Use SRD_API to mark public API symbols, and SRD_PRIV for private symbols. + * + * Variables and functions marked 'static' are private already and don't + * need SR_PRIV. However, functions which are not static (because they need + * to be used in other libsigrokdecode-internal files) but are also not + * meant to be part of the public libsigrokdecode API, must use SRD_PRIV. + * + * This uses the 'visibility' feature of gcc (requires gcc >= 4.0). + * + * Details: http://gcc.gnu.org/wiki/Visibility + */ + +/* Marks public libsigrokdecode API symbols. */ +#define SRD_API __attribute__((visibility("default"))) + +/* Marks private, non-public libsigrokdecode symbols (not part of the API). */ +#define SRD_PRIV __attribute__((visibility("hidden"))) + /* * When adding an output type, don't forget to... * - expose it to PDs in controller.c:PyInit_sigrokdecode() @@ -176,67 +195,69 @@ typedef struct { /*--- controller.c ----------------------------------------------------------*/ -int srd_init(void); -int srd_exit(void); -int set_modulepath(void); -int srd_instance_set_options(struct srd_decoder_instance *di, - GHashTable *options); -int srd_instance_set_probes(struct srd_decoder_instance *di, - GHashTable *probes); -struct srd_decoder_instance *srd_instance_new(const char *id, - GHashTable *options); -int srd_instance_stack(struct srd_decoder_instance *di_from, - struct srd_decoder_instance *di_to); -struct srd_decoder_instance *srd_instance_find_by_id(char *instance_id); -struct srd_decoder_instance *srd_instance_find_by_obj(GSList *stack, - PyObject *obj); -int srd_instance_start(struct srd_decoder_instance *di, PyObject *args); -int srd_instance_decode(uint64_t start_samplenum, - struct srd_decoder_instance *dec, - uint8_t *inbuf, uint64_t inbuflen); -void srd_instance_free(struct srd_decoder_instance *di); -void srd_instance_free_all(GSList *stack); -int srd_session_start(int num_probes, int unitsize, uint64_t samplerate); -int srd_session_feed(uint64_t start_samplenum, uint8_t *inbuf, - uint64_t inbuflen); -int pd_add(struct srd_decoder_instance *di, int output_type, char *output_id); -struct srd_decoder_instance *get_di_by_decobject(void *decobject); +SRD_API int srd_init(void); +SRD_API int srd_exit(void); +SRD_API int set_modulepath(void); +SRD_API int srd_instance_set_options(struct srd_decoder_instance *di, + GHashTable *options); +SRD_API int srd_instance_set_probes(struct srd_decoder_instance *di, + GHashTable *probes); +SRD_API struct srd_decoder_instance *srd_instance_new(const char *id, + GHashTable *options); +SRD_API int srd_instance_stack(struct srd_decoder_instance *di_from, + struct srd_decoder_instance *di_to); +SRD_API struct srd_decoder_instance *srd_instance_find_by_id(char *instance_id); +SRD_API struct srd_decoder_instance *srd_instance_find_by_obj(GSList *stack, + PyObject *obj); +SRD_API int srd_instance_start(struct srd_decoder_instance *di, PyObject *args); +SRD_API int srd_instance_decode(uint64_t start_samplenum, + struct srd_decoder_instance *dec, + uint8_t *inbuf, uint64_t inbuflen); +SRD_API void srd_instance_free(struct srd_decoder_instance *di); +SRD_API void srd_instance_free_all(GSList *stack); +SRD_API int srd_session_start(int num_probes, int unitsize, + uint64_t samplerate); +SRD_API int srd_session_feed(uint64_t start_samplenum, uint8_t *inbuf, + uint64_t inbuflen); +SRD_PRIV int pd_add(struct srd_decoder_instance *di, int output_type, + char *output_id); +SRD_API struct srd_decoder_instance *get_di_by_decobject(void *decobject); typedef void (*srd_pd_output_callback_t)(struct srd_proto_data *pdata); -int srd_register_callback(int output_type, srd_pd_output_callback_t cb); -void *srd_find_callback(int output_type); +SRD_API int srd_register_callback(int output_type, srd_pd_output_callback_t cb); +SRD_API void *srd_find_callback(int output_type); /*--- decoder.c -------------------------------------------------------------*/ -GSList *srd_list_decoders(void); -struct srd_decoder *srd_get_decoder_by_id(const char *id); -int srd_load_decoder(const char *name, struct srd_decoder **dec); -int srd_unload_decoder(struct srd_decoder *dec); -int srd_load_all_decoders(void); -int srd_unload_all_decoders(void); -char *srd_decoder_doc(struct srd_decoder *dec); +SRD_API GSList *srd_list_decoders(void); +SRD_API struct srd_decoder *srd_get_decoder_by_id(const char *id); +SRD_API int srd_load_decoder(const char *name, struct srd_decoder **dec); +SRD_API int srd_unload_decoder(struct srd_decoder *dec); +SRD_API int srd_load_all_decoders(void); +SRD_API int srd_unload_all_decoders(void); +SRD_API char *srd_decoder_doc(struct srd_decoder *dec); /*--- exception.c -----------------------------------------------------------*/ -void catch_exception(const char *format, ...); +SRD_PRIV void catch_exception(const char *format, ...); /*--- util.c ----------------------------------------------------------------*/ -int py_attr_as_str(PyObject *py_obj, const char *attr, char **outstr); -int py_dictitem_as_str(PyObject *py_obj, const char *key, char **outstr); -int py_str_as_str(PyObject *py_str, char **outstr); -int py_strlist_to_char(PyObject *py_strlist, char ***outstr); +SRD_PRIV int py_attr_as_str(PyObject *py_obj, const char *attr, char **outstr); +SRD_PRIV int py_dictitem_as_str(PyObject *py_obj, const char *key, char **outstr); +SRD_PRIV int py_str_as_str(PyObject *py_str, char **outstr); +SRD_PRIV int py_strlist_to_char(PyObject *py_strlist, char ***outstr); /*--- log.c -----------------------------------------------------------------*/ typedef int (*srd_log_handler_t)(void *data, int loglevel, const char *format, va_list args); -int srd_log_loglevel_set(int loglevel); -int srd_log_loglevel_get(void); -int srd_log_handler_set(srd_log_handler_t handler, void *data); -int srd_log_handler_set_default(void); -int srd_log_logdomain_set(const char *logdomain); -char *srd_log_logdomain_get(void); +SRD_API int srd_log_loglevel_set(int loglevel); +SRD_API int srd_log_loglevel_get(void); +SRD_API int srd_log_handler_set(srd_log_handler_t handler, void *data); +SRD_API int srd_log_handler_set_default(void); +SRD_API int srd_log_logdomain_set(const char *logdomain); +SRD_API char *srd_log_logdomain_get(void); #ifdef __cplusplus } diff --git a/type_decoder.c b/type_decoder.c index 39ea3b7..9c2cfd6 100644 --- a/type_decoder.c +++ b/type_decoder.c @@ -207,7 +207,7 @@ static PyMethodDef Decoder_methods[] = { {NULL, NULL, 0, NULL} }; -PyTypeObject srd_Decoder_type = { +SRD_PRIV PyTypeObject srd_Decoder_type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "sigrokdecode.Decoder", .tp_basicsize = sizeof(srd_Decoder), diff --git a/type_logic.c b/type_logic.c index ebe81e3..5e499f4 100644 --- a/type_logic.c +++ b/type_logic.c @@ -22,12 +22,12 @@ #include #include -PyObject *srd_logic_iter(PyObject *self) +static PyObject *srd_logic_iter(PyObject *self) { return self; } -PyObject *srd_logic_iternext(PyObject *self) +static PyObject *srd_logic_iternext(PyObject *self) { int i; PyObject *py_samplenum, *py_samples; @@ -66,7 +66,7 @@ PyObject *srd_logic_iternext(PyObject *self) return logic->sample; } -PyTypeObject srd_logic_type = { +SRD_PRIV PyTypeObject srd_logic_type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "srd_logic", .tp_basicsize = sizeof(srd_logic), diff --git a/util.c b/util.c index 18b316e..5f18639 100644 --- a/util.c +++ b/util.c @@ -33,7 +33,7 @@ * @return SRD_OK upon success, a (negative) error code otherwise. * The 'outstr' argument points to a malloc()ed string upon success. */ -int py_attr_as_str(PyObject *py_obj, const char *attr, char **outstr) +SRD_PRIV int py_attr_as_str(PyObject *py_obj, const char *attr, char **outstr) { PyObject *py_str; int ret; @@ -73,7 +73,8 @@ int py_attr_as_str(PyObject *py_obj, const char *attr, char **outstr) * @return SRD_OK upon success, a (negative) error code otherwise. * The 'outstr' argument points to a malloc()ed string upon success. */ -int py_dictitem_as_str(PyObject *py_obj, const char *key, char **outstr) +SRD_PRIV int py_dictitem_as_str(PyObject *py_obj, const char *key, + char **outstr) { PyObject *py_value; int ret; @@ -110,7 +111,7 @@ int py_dictitem_as_str(PyObject *py_obj, const char *key, char **outstr) * @return SRD_OK upon success, a (negative) error code otherwise. * The 'outstr' argument points to a malloc()ed string upon success. */ -int py_str_as_str(PyObject *py_str, char **outstr) +SRD_PRIV int py_str_as_str(PyObject *py_str, char **outstr) { PyObject *py_encstr; int ret; @@ -163,7 +164,7 @@ err_out: * @return SRD_OK upon success, a (negative) error code otherwise. * The 'outstr' argument points to a malloc()ed char ** upon success. */ -int py_strlist_to_char(PyObject *py_strlist, char ***outstr) +SRD_PRIV int py_strlist_to_char(PyObject *py_strlist, char ***outstr) { PyObject *py_str; int list_len, i; -- 2.30.2