Skip to content

Commit

Permalink
Merge pull request #831 from morrone/unpointer_flux_modlist_t
Browse files Browse the repository at this point in the history
module: Remove pointer from typedef flux_modlist_t
  • Loading branch information
garlick authored Oct 4, 2016
2 parents fb19bd9 + 9718ae8 commit 323aa53
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/broker/broker.c
Original file line number Diff line number Diff line change
Expand Up @@ -2006,7 +2006,7 @@ static int cmb_insmod_cb (zmsg_t **zmsg, void *arg)
static int cmb_lsmod_cb (zmsg_t **zmsg, void *arg)
{
ctx_t *ctx = arg;
flux_modlist_t mods = NULL;
flux_modlist_t *mods = NULL;
char *json_str = NULL;
int rc = -1;

Expand Down
4 changes: 2 additions & 2 deletions src/broker/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,9 @@ void modhash_set_heartbeat (modhash_t *mh, heartbeat_t *hb)
mh->heartbeat = hb;
}

flux_modlist_t module_get_modlist (modhash_t *mh)
flux_modlist_t *module_get_modlist (modhash_t *mh)
{
flux_modlist_t mods;
flux_modlist_t *mods;
zlist_t *uuids;
char *uuid;
module_t *p;
Expand Down
2 changes: 1 addition & 1 deletion src/broker/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ int module_stop_all (modhash_t *mh);

/* Prepare an 'lsmod' response payload.
*/
flux_modlist_t module_get_modlist (modhash_t *mh);
flux_modlist_t *module_get_modlist (modhash_t *mh);

#endif /* !_BROKER_MODULE_H */

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/flux-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ void lsmod_map_hash (zhash_t *mods, flux_lsmod_f cb, void *arg)

int lsmod_merge_result (uint32_t nodeid, const char *json_str, zhash_t *mods)
{
flux_modlist_t modlist;
flux_modlist_t *modlist;
mod_t *m;
int i, len;
const char *name, *digest;
Expand Down
20 changes: 10 additions & 10 deletions src/common/libflux/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ char *flux_rmmod_json_encode (const char *name)
return json_str;
}

int flux_modlist_get (flux_modlist_t mods, int n, const char **name, int *size,
int flux_modlist_get (flux_modlist_t *mods, int n, const char **name, int *size,
const char **digest, int *idle, int *status)
{
JSON o, a;
Expand All @@ -154,7 +154,7 @@ int flux_modlist_get (flux_modlist_t mods, int n, const char **name, int *size,
return rc;
}

int flux_modlist_count (flux_modlist_t mods)
int flux_modlist_count (flux_modlist_t *mods)
{
JSON a;
int len;
Expand All @@ -166,7 +166,7 @@ int flux_modlist_count (flux_modlist_t mods)
return len;
}

int flux_modlist_append (flux_modlist_t mods, const char *name, int size,
int flux_modlist_append (flux_modlist_t *mods, const char *name, int size,
const char *digest, int idle, int status)
{
JSON a, o = Jnew ();
Expand All @@ -188,30 +188,30 @@ int flux_modlist_append (flux_modlist_t mods, const char *name, int size,
return rc;
}

void flux_modlist_destroy (flux_modlist_t mods)
void flux_modlist_destroy (flux_modlist_t *mods)
{
if (mods) {
Jput (mods->o);
free (mods);
}
}

flux_modlist_t flux_modlist_create (void)
flux_modlist_t *flux_modlist_create (void)
{
flux_modlist_t mods = xzmalloc (sizeof (*mods));
flux_modlist_t *mods = xzmalloc (sizeof (*mods));
mods->o = Jnew ();
json_object_object_add (mods->o, "mods", Jnew_ar ());
return mods;
}

char *flux_lsmod_json_encode (flux_modlist_t mods)
char *flux_lsmod_json_encode (flux_modlist_t *mods)
{
return xstrdup (Jtostr (mods->o));
}

flux_modlist_t flux_lsmod_json_decode (const char *json_str)
flux_modlist_t *flux_lsmod_json_decode (const char *json_str)
{
flux_modlist_t mods = xzmalloc (sizeof (*mods));
flux_modlist_t *mods = xzmalloc (sizeof (*mods));
if (!(mods->o = Jfromstr (json_str))) {
free (mods);
errno = EPROTO;
Expand Down Expand Up @@ -346,7 +346,7 @@ int flux_lsmod (flux_t h, uint32_t nodeid, const char *service,
{
flux_rpc_t *r = NULL;
char *topic = xasprintf ("%s.lsmod", service ? service : "cmb");
flux_modlist_t mods = NULL;
flux_modlist_t *mods = NULL;
const char *json_str;
int rc = -1;
int i, len;
Expand Down
16 changes: 8 additions & 8 deletions src/common/libflux/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,19 @@ char *flux_modfind (const char *searchpath, const char *modname);
* 'flux_modlist_t' is an intermediate object that can encode/decode
* to/from a JSON string, and provides accessors for module list entries.
*/
typedef struct flux_modlist_struct *flux_modlist_t;
typedef struct flux_modlist_struct flux_modlist_t;

flux_modlist_t flux_modlist_create (void);
void flux_modlist_destroy (flux_modlist_t mods);
int flux_modlist_append (flux_modlist_t mods, const char *name, int size,
flux_modlist_t *flux_modlist_create (void);
void flux_modlist_destroy (flux_modlist_t *mods);
int flux_modlist_append (flux_modlist_t *mods, const char *name, int size,
const char *digest, int idle, int status);
int flux_modlist_count (flux_modlist_t mods);
int flux_modlist_get (flux_modlist_t mods, int idx, const char **name,
int flux_modlist_count (flux_modlist_t *mods);
int flux_modlist_get (flux_modlist_t *mods, int idx, const char **name,
int *size, const char **digest, int *idle,
int *status);

char *flux_lsmod_json_encode (flux_modlist_t mods);
flux_modlist_t flux_lsmod_json_decode (const char *json_str);
char *flux_lsmod_json_encode (flux_modlist_t *mods);
flux_modlist_t *flux_lsmod_json_decode (const char *json_str);


/* Encode/decode rmmod payload.
Expand Down
2 changes: 1 addition & 1 deletion src/common/libflux/test/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void test_helpers (void)

void test_lsmod_codec (void)
{
flux_modlist_t mods;
flux_modlist_t *mods;
int idle, size;
const char *name, *digest;
char *json_str;
Expand Down
6 changes: 3 additions & 3 deletions t/module/parent.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ static module_t *module_create (const char *path, char *argz, size_t argz_len)
return m;
}

static flux_modlist_t module_list (void)
static flux_modlist_t *module_list (void)
{
flux_modlist_t mods = flux_modlist_create ();
flux_modlist_t *mods = flux_modlist_create ();
zlist_t *keys = zhash_keys (modules);
module_t *m;
char *name;
Expand Down Expand Up @@ -177,7 +177,7 @@ static void rmmod_request_cb (flux_t h, flux_msg_handler_t *w,
static void lsmod_request_cb (flux_t h, flux_msg_handler_t *w,
const flux_msg_t *msg, void *arg)
{
flux_modlist_t mods = NULL;
flux_modlist_t *mods = NULL;
char *json_str = NULL;
int rc = -1, saved_errno;

Expand Down

0 comments on commit 323aa53

Please sign in to comment.