extern log4c_layout_t* log4c_layout_new(const char* a_name) { log4c_layout_t* this; if (!a_name) return NULL; this = sd_calloc(1, sizeof(log4c_layout_t)); this->lo_name = sd_strdup(a_name); this->lo_type = &log4c_layout_type_basic; this->lo_udata = NULL; return this; }
extern sd_factory_t* sd_factory_new(const char* a_name, const sd_factory_ops_t* a_ops) { sd_factory_t* this; if (!a_name || !a_ops) return NULL; this = sd_calloc(1, sizeof(*this)); this->fac_name = sd_strdup(a_name); this->fac_ops = a_ops; this->fac_hash = sd_hash_new(20, NULL); return this; }
extern log4c_appender_t* log4c_appender_new(const char* a_name) { log4c_appender_t* this; if (!a_name) return NULL; this = sd_calloc(1, sizeof(log4c_appender_t)); this->app_name = sd_strdup(a_name); this->app_type = &log4c_appender_type_stream; this->app_layout = log4c_layout_get("basic"); this->app_isopen = 0; this->app_udata = NULL; return this; }
LOG4C_API log4c_rollingpolicy_t* log4c_rollingpolicy_new(const char* a_name){ log4c_rollingpolicy_t* this; sd_debug("log4c_rollingpolicy_new[ "); if (!a_name) return NULL; sd_debug("new policy name='%s'", a_name); this = sd_calloc(1, sizeof(log4c_rollingpolicy_t)); this->policy_name = sd_strdup(a_name); this->policy_type = &log4c_rollingpolicy_type_sizewin; this->policy_udata = NULL; this->policy_rfudatap = NULL; this->policy_flags = 0; sd_debug("]"); return this; }
int sd_stringparser_set_string(sd_stringparser *parser, const char *string) { if(parser->string) free(parser->string); parser->string = sd_strdup(string); sd_stringparser_reset(parser); int frames=0; parse_string(parser, cb_count_frame, NULL, &frames); sd_framelist_resize(parser->frame_list, frames); // ignore animation string that does not contain frame letters if(frames > 0) { frames = 0; parse_string(parser, cb_set_frame, NULL, &frames); // now store the tags and params into the frame struct frames = 0; parse_string(parser, cb_count_frame, cb_store_tag, &frames); return 0; } return SD_ANIM_INVALID_STRING; }