示例#1
0
static int cx_handle_parsed_xml(xmlDocPtr doc, /* {{{ */ 
                       xmlXPathContextPtr xpath_ctx, cx_t *db)
{
  llentry_t *le;
  const data_set_t *ds;
  cx_xpath_t *xpath;
  int status=-1;
  

  le = llist_head (db->list);
  while (le != NULL)
  {
    /* get the ds */
    xpath = (cx_xpath_t *) le->value;
    ds = plugin_get_ds (xpath->type);

    if ( (cx_check_type(ds, xpath) == 0) &&
         (cx_handle_base_xpath(db->instance, db->host,
                               xpath_ctx, ds, le->key, xpath) == 0) )
      status = 0; /* we got atleast one success */

    le = le->next;
  } /* while (le != NULL) */

  return status;
} /* }}} cx_handle_parsed_xml */
示例#2
0
static int powerdns_read(void) {
  for (llentry_t *e = llist_head(list); e != NULL; e = e->next) {
    list_item_t *item = e->value;
    item->func(item);
  }

  return (0);
} /* static int powerdns_read */
示例#3
0
文件: parse.c 项目: SrTobi/fakeasm
static void add_all_params(VarList params, Function* fun)
{
    if(params == llist_empty)
        return;

    add_all_params(llist_tail(params), fun);
    function_add_parameter(fun, llist_head(params));
}
示例#4
0
文件: zfs_arc.c 项目: ajdiaz/collectd
static void free_zfs_values(kstat_t *ksp) {
  if (ksp == NULL)
    return;

  for (llentry_t *e = llist_head(ksp); e != NULL; e = e->next) {
    sfree(e->key);
    sfree(e->value);
  }

  llist_destroy(ksp);
}
示例#5
0
LumieraConfigitem
lumiera_config_lookup_item_find (LumieraConfigLookup self, const char* key)
{
  TRACE (configlookup_dbg, "%s", key);

  LumieraConfigLookupentry entry =
    lumiera_config_lookup_find (self, key);

  if (entry && !llist_is_empty (&entry->configitems))
    return LLIST_TO_STRUCTP (llist_head (&entry->configitems), lumiera_configitem, lookup);

  return NULL;
}
示例#6
0
文件: parse.c 项目: SrTobi/fakeasm
void push_function(const char* name, VarList params)
{
    Function* context = NULL;
    if(funstack != llist_empty)
    {
        context = llist_head(funstack);
    }
    
    Function* f = new_function(name, context);
    
    add_all_params(params, f);
    
    funstack = llist_prepend(f, funstack);
}
示例#7
0
static int cx_handle_parsed_xml(cx_t *db, xmlDocPtr doc, /* {{{ */
                                xmlXPathContextPtr xpath_ctx) {
  int status = -1;

  llentry_t *le = llist_head(db->xpath_list);
  while (le != NULL) {
    cx_xpath_t *xpath = (cx_xpath_t *)le->value;

    if (cx_handle_xpath(db, xpath_ctx, xpath) == 0)
      status = 0; /* we got atleast one success */

    le = le->next;
  } /* while (le != NULL) */

  return status;
} /* }}} cx_handle_parsed_xml */
示例#8
0
static void cx_xpath_list_free(llist_t *list) /* {{{ */
{
  llentry_t *le;

  le = llist_head(list);
  while (le != NULL) {
    llentry_t *le_next = le->next;

    /* this also frees xpath->path used for le->key */
    cx_xpath_free(le->value);

    le = le_next;
  }

  llist_destroy(list);
} /* }}} void cx_xpath_list_free */
示例#9
0
文件: parse.c 项目: SrTobi/fakeasm
Statement* push_funcall(const char* funname, ArgArray args)
{
    Function* curf = cur_func();
    Statement* statm = new_statement(funname, args);
    
    // set all labels and pop
    while(curlabels != llist_empty)
    {
        llist_head(curlabels)->statm = statm;
        curlabels = llist_tail(curlabels);
    }
    
    // register
    array_push(curf->statms, Statement*, statm);
    return statm;
}
示例#10
0
static int powerdns_shutdown(void) {
  if (list == NULL)
    return (0);

  for (llentry_t *e = llist_head(list); e != NULL; e = e->next) {
    list_item_t *item = (list_item_t *)e->value;
    e->value = NULL;

    sfree(item->instance);
    sfree(item->command);
    sfree(item);
  }

  llist_destroy(list);
  list = NULL;

  return (0);
} /* static int powerdns_shutdown */
示例#11
0
static void mr_free_match(mr_match_t *m) /* {{{ */
{
  if (m == NULL)
    return;

  mr_free_regex(m->host);
  mr_free_regex(m->plugin);
  mr_free_regex(m->plugin_instance);
  mr_free_regex(m->type);
  mr_free_regex(m->type_instance);
  for (llentry_t *e = llist_head(m->meta); e != NULL; e = e->next) {
    sfree(e->key);
    mr_free_regex((mr_regex_t *)e->value);
  }
  llist_destroy(m->meta);

  sfree(m);
} /* }}} void mr_free_match */
示例#12
0
static void cx_list_free(llist_t *list) /* {{{ */
{
  llentry_t *le;

  le = llist_head(list);
  while (le != NULL) {
    llentry_t *le_next;

    le_next = le->next;

    sfree(le->key);
    cx_xpath_free(le->value);

    le = le_next;
  }

  llist_destroy(list);
} /* }}} void cx_list_free */
示例#13
0
//发送相关函数
static inline st_io *prepare_send(struct connection *c)
{
	int32_t i = 0;
    wpacket_t w = (wpacket_t)llist_head(&c->send_list);
	buffer_t b;
	uint32_t pos;
	st_io *O = NULL;
	uint32_t buffer_size = 0;
	uint32_t size = 0;
	uint32_t send_size_remain = MAX_SEND_SIZE;
	while(w && i < MAX_WBAF && send_size_remain > 0)
	{
		pos = w->base.begin_pos;
		b = w->base.buf;
		buffer_size = w->data_size;
		while(i < MAX_WBAF && b && buffer_size && send_size_remain > 0)
		{
			c->wsendbuf[i].iov_base = b->buf + pos;
			size = b->size - pos;
			size = size > buffer_size ? buffer_size:size;
			size = size > send_size_remain ? send_size_remain:size;
			buffer_size -= size;
			send_size_remain -= size;
			c->wsendbuf[i].iov_len = size;
			++i;
			b = b->next;
			pos = 0;
		}
        if(send_size_remain > 0) w = (wpacket_t)MSG_NEXT(w);//(wpacket_t)w->base.next.next;
	}
	if(i){
		c->send_overlap.m_super.iovec_count = i;
		c->send_overlap.m_super.iovec = c->wsendbuf;
		O = (st_io*)&c->send_overlap;
	}
	return O;

}
示例#14
0
文件: plugin.c 项目: cstenac/collectd
static void destroy_all_callbacks (llist_t **list) /* {{{ */
{
	llentry_t *le;

	if (*list == NULL)
		return;

	le = llist_head (*list);
	while (le != NULL)
	{
		llentry_t *le_next;

		le_next = le->next;

		sfree (le->key);
		destroy_callback (le->value);
		le->value = NULL;

		le = le_next;
	}

	llist_destroy (*list);
	*list = NULL;
} /* }}} void destroy_all_callbacks */
示例#15
0
文件: parse.c 项目: SrTobi/fakeasm
Function* cur_func()
{
    return llist_head(funstack);
}