static int modrequest_unload(TCFactory factory, ModRequest *modr)
{
    if (factory == NULL || modr == NULL) {
        tc_log_warn(EXE, "wrong parameters for modrequest_load");
        return TC_ERROR;
    }

    tc_del_module(factory, modr->module);
    tc_strfreev(modr->rawdata);

    /* re-blank fields */
    modrequest_init(modr);

    return TC_OK;
}
Esempio n. 2
0
static int tc_log_debug_init(const char *envname)
{
    const char *envvar = getenv(envname);
    if (envvar) {
        size_t i = 0, n = 0;
        char **tokens = tc_strsplit(envvar, ',', &n);
        int j = 0;

        if (tokens) {
            for (i = 0; i < n; i++) {
                for (j = 0; DebugFlags[j].name != NULL; j++) {
                    if (strcmp(DebugFlags[j].name, tokens[i]) == 0) {
                        TCLog.debug_src |= DebugFlags[j].flag;
                    }
                }
            }

            tc_strfreev(tokens);
        }
    }
    return TC_OK;
}