Skip to content

Commit

Permalink
ejson 1.1.0: adjust APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyht committed May 6, 2019
1 parent 00e77db commit e307c87
Show file tree
Hide file tree
Showing 13 changed files with 700 additions and 805 deletions.
4 changes: 2 additions & 2 deletions src/libs/etools/earg.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ int earg_parse(earg h, int argc, cstr argv[])
}

short_arg[0] = (u8)opt;
arg = ejsonk_valR(h->args_d, short_arg);
arg = ejson_kvalR(h->args_d, short_arg);
if(!arg)
{
fprintf (stderr, "%s option unknown: %c\n", h->desc, *short_arg);
Expand Down Expand Up @@ -246,5 +246,5 @@ arg earg_find(earg h, char tag)
char short_arg[4] = {0};
short_arg[0] = tag;

return h ? ejsonk_valR(h->args_d, short_arg) : 0;
return h ? ejson_kvalR(h->args_d, short_arg) : 0;
}
223 changes: 112 additions & 111 deletions src/libs/etools/ejson.c

Large diffs are not rendered by default.

364 changes: 129 additions & 235 deletions src/libs/etools/ejson.h

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/libs/etools/enats.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ static inline ejson __enats_makeRoomForSubs(enats e, constr subj, enats_msgHandl
mutex_ulck(e->sub_mu);
is0_exeret(subs, errfmt(e, "subs of \"%s\" already exist", subj), 0);

assert(sroom = ejsonk(e->sub_dic, subj));
assert(sroom = ejson_k(e->sub_dic, subj));

subs->e = e;
subs->msg_handler = onMsg;
Expand Down Expand Up @@ -797,7 +797,7 @@ static inline void __enats_stats(enats trans, constr subj, enats_stats_t* stats,
s = natsConnection_GetStats(trans->conn.nc, (natsStatistics*)stats);

mutex_lock(trans->sub_mu);
ntSub = ejsonk_valR(trans->sub_dic, subj);
ntSub = ejson_kvalR(trans->sub_dic, subj);
mutex_ulck(trans->sub_mu);
if ((s == NATS_OK) && (ntSub != NULL))
{
Expand Down Expand Up @@ -1371,7 +1371,7 @@ static void __enatp_exeLazyThread(enatp p)

static inline int __enatp_chkName(enatp p, constr name)
{
return !ejsonk(p->name_groups, name);
return !ejson_k(p->name_groups, name);
}

static inline ejson __enatp_getGroup(enatp p, constr name)
Expand All @@ -1380,7 +1380,7 @@ static inline ejson __enatp_getGroup(enatp p, constr name)

enatp_lock(p);

egroup = ejsonk(p->name_groups, name);
egroup = ejson_k(p->name_groups, name);

if(!egroup)
{
Expand All @@ -1401,7 +1401,7 @@ static inline int __enatp_getAvailNameIdForGroup(enatp p, ejson egroup, char ena
do
{
snprintf(ename, 64, "%s.%d", eobj_keyS(egroup),++id);
}while(ejsonk(egroup, ename));
}while(ejson_k(egroup, ename));

enatp_ulck(p);

Expand Down Expand Up @@ -1532,7 +1532,7 @@ static inline ejson __enatp_getEnatsRooms(enatp p, constr name)
else if(name == ENATP_ALL_TRANS) eroom = p->name_groups;
else {
enatp_lock(p);
eroom = ejsonk(p->name_groups, name);
eroom = ejson_k(p->name_groups, name);
enatp_ulck(p);
}

Expand Down
2 changes: 1 addition & 1 deletion src/libs/etools/ert.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ int ert_query(ert tp, constr tag)
is0_ret(tp->status == _INITED, 0);

tasks_lock();
ret = ejsonk(tp->tasks_tags, tag) ? 1 : 0;
ret = ejson_k(tp->tasks_tags, tag) ? 1 : 0;
tasks_ulck();

return ret;
Expand Down
Loading

0 comments on commit e307c87

Please sign in to comment.