예제 #1
0
파일: zconfig.c 프로젝트: RUNDSP/czmq
zchunk_t *
zconfig_chunk_save (zconfig_t *self)
{
    assert (self);

    int size = s_config_execute (self, s_config_save, NULL, 0);
    //  Allow an extra byte so we can null-terminate the data
    zchunk_t *chunk = zchunk_new (NULL, size + 1);
    if (chunk) {
        s_config_execute (self, s_config_save, chunk, 0);
        //  This lets us treat the chunk data as a string
        zchunk_data (chunk) [zchunk_size (chunk)] = 0;
    }
    return chunk;
}
예제 #2
0
파일: zconfig.c 프로젝트: Prarrot/czmq
int
zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg)
{
    //  Execute top level config at level zero
    assert (self);
    return s_config_execute (self, handler, arg, 0);
}
예제 #3
0
파일: zfl_config.c 프로젝트: mkoppanen/zfl
static int
s_config_execute (zfl_config_t *self, zfl_config_fct handler, void *arg, int level)
{
    assert (self);
    int rc = handler (self, arg, level);

    //  Process all children in one go, as a list
    zfl_config_t *child = self->child;
    while (child && !rc) {
        rc = s_config_execute (child, handler, arg, level + 1);
        child = child->next;
    }
    return rc;
}
예제 #4
0
파일: zconfig.c 프로젝트: Prarrot/czmq
static int
s_config_execute (zconfig_t *self, zconfig_fct handler, void *arg, int level)
{
    assert (self);
    int rc = handler (self, arg, level);

    //  Process all children in one go, as a list
    zconfig_t *child = self->child;
    while (child && !rc) {
        rc = s_config_execute (child, handler, arg, level + 1);
        if (rc == -1)
            break;              //  -1 from callback means end execution
        child = child->next;
    }
    return rc;
}
예제 #5
0
파일: zconfig.c 프로젝트: RUNDSP/czmq
static int
s_config_execute (zconfig_t *self, zconfig_fct handler, void *arg, int level)
{
    assert (self);
    int size = handler (self, arg, level);

    //  Process all children in one go, as a list
    zconfig_t *child = self->child;
    while (child) {
        int rc = s_config_execute (child, handler, arg, level + 1);
        if (rc == -1)
            return -1;
        size += rc;
        child = child->next;
    }
    return size;
}