Skip to content

Commit

Permalink
obexd: const annotate obex_plugin_desc entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
evelikov-work authored and Vudentz committed Jan 19, 2024
1 parent ac1d236 commit e0c64a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions obexd/src/genbuiltin
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

for i in $*
do
echo "extern struct obex_plugin_desc __obex_builtin_$i;"
echo "extern const struct obex_plugin_desc __obex_builtin_$i;"
done

echo
echo "static struct obex_plugin_desc *__obex_builtin[] = {"
echo "static const struct obex_plugin_desc *__obex_builtin[] = {"

for i in $*
do
Expand Down
8 changes: 4 additions & 4 deletions obexd/src/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ static GSList *plugins = NULL;

struct obex_plugin {
void *handle;
struct obex_plugin_desc *desc;
const struct obex_plugin_desc *desc;
};

static gboolean add_plugin(void *handle, struct obex_plugin_desc *desc)
static gboolean add_plugin(void *handle, const struct obex_plugin_desc *desc)
{
struct obex_plugin *plugin;

Expand All @@ -66,7 +66,7 @@ static gboolean add_plugin(void *handle, struct obex_plugin_desc *desc)
return TRUE;
}

static gboolean check_plugin(struct obex_plugin_desc *desc,
static gboolean check_plugin(const struct obex_plugin_desc *desc,
char **patterns, char **excludes)
{
if (excludes) {
Expand Down Expand Up @@ -132,7 +132,7 @@ gboolean plugin_init(const char *pattern, const char *exclude)
}

while ((file = g_dir_read_name(dir)) != NULL) {
struct obex_plugin_desc *desc;
const struct obex_plugin_desc *desc;
void *handle;
char *filename;

Expand Down
4 changes: 2 additions & 2 deletions obexd/src/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ struct obex_plugin_desc {

#ifdef OBEX_PLUGIN_BUILTIN
#define OBEX_PLUGIN_DEFINE(name, init, exit) \
struct obex_plugin_desc __obex_builtin_ ## name = { \
const struct obex_plugin_desc __obex_builtin_ ## name = { \
#name, init, exit \
};
#else
#define OBEX_PLUGIN_DEFINE(name,init,exit) \
extern struct obex_plugin_desc obex_plugin_desc \
__attribute__ ((visibility("default"))); \
struct obex_plugin_desc obex_plugin_desc = { \
const struct obex_plugin_desc obex_plugin_desc = { \
#name, init, exit \
};
#endif

0 comments on commit e0c64a2

Please sign in to comment.