コード例 #1
0
ファイル: flux-up.c プロジェクト: dinesh121991/flux-core
static ns_t *ns_fromjson (JSON o)
{
    ns_t *ns = xzmalloc (sizeof (*ns));

    if (!Jget_nodeset (o, "ok", &ns->ok)
                || !Jget_nodeset (o, "unknown", &ns->unknown)
                || !Jget_nodeset (o, "slow", &ns->slow)
                || !Jget_nodeset (o, "fail", &ns->fail)) {
        ns_destroy (ns);
        return NULL;
    }
    return ns;
}
コード例 #2
0
ファイル: flux-up.c プロジェクト: cigolabs/flux-core
static ns_t *ns_fromjson (const char *json_str)
{
    ns_t *ns = xzmalloc (sizeof (*ns));
    JSON o = NULL;

    if (!(o = Jfromstr (json_str))
                || !Jget_nodeset (o, "ok", &ns->ok)
                || !Jget_nodeset (o, "unknown", &ns->unknown)
                || !Jget_nodeset (o, "slow", &ns->slow)
                || !Jget_nodeset (o, "fail", &ns->fail)) {
        ns_destroy (ns);
        ns = NULL;
    }
    Jput (o);
    return ns;
}