这篇教程C++ strbuf_free函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中strbuf_free函数的典型用法代码示例。如果您正苦于以下问题:C++ strbuf_free函数的具体用法?C++ strbuf_free怎么用?C++ strbuf_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了strbuf_free函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: strbuf_initstatic ContentItem *parse_hhc(HHInfo *info, IStream *str, ContentItem *hhc_root, insert_type_t *insert_type){ stream_t stream; strbuf_t node, node_name; ContentItem *ret = NULL, *prev = NULL; *insert_type = INSERT_NEXT; strbuf_init(&node); strbuf_init(&node_name); stream_init(&stream, str); while(next_node(&stream, &node)) { get_node_name(&node, &node_name); TRACE("%s/n", node.buf); if(!strcasecmp(node_name.buf, "ul")) { ContentItem *item = parse_ul(info, &stream, hhc_root); prev = insert_item(prev, item, INSERT_CHILD); if(!ret) ret = prev; *insert_type = INSERT_CHILD; } strbuf_zero(&node); } strbuf_free(&node); strbuf_free(&node_name); return ret;}
开发者ID:AlexSteel,项目名称:wine,代码行数:35,
示例2: next_nodeBOOL next_node(stream_t *stream, strbuf_t *buf){ strbuf_t tmpbuf; /* search through the end of the current node */ strbuf_init(&tmpbuf); if(!find_node_end(stream, &tmpbuf)) { strbuf_free(&tmpbuf); return FALSE; } strbuf_free(&tmpbuf); /* find the beginning of the next node */ if(!stream_chr(stream, NULL, '<')) return FALSE; /* read out the data of the next node */ if(!find_node_end(stream, buf)) return FALSE; strbuf_append(buf, ">", 2); return TRUE;}
开发者ID:ZoloZiak,项目名称:reactos,代码行数:25,
示例3: strbuf_init/* Parse the object tag corresponding to a list item. * * At this step we look for all of the "param" child tags, using this information * to build up the information about the list item. When we reach the </object> * tag we know that we've finished parsing this list item. */static IndexItem *parse_index_sitemap_object(HHInfo *info, stream_t *stream){ strbuf_t node, node_name; IndexItem *item; strbuf_init(&node); strbuf_init(&node_name); item = heap_alloc_zero(sizeof(IndexItem)); item->nItems = 0; item->items = heap_alloc_zero(0); item->itemFlags = 0x11; while(next_node(stream, &node)) { get_node_name(&node, &node_name); TRACE("%s/n", node.buf); if(!strcasecmp(node_name.buf, "param")) { parse_index_obj_node_param(item, node.buf, info->pCHMInfo->codePage); }else if(!strcasecmp(node_name.buf, "/object")) { break; }else { WARN("Unhandled tag! %s/n", node_name.buf); } strbuf_zero(&node); } strbuf_free(&node); strbuf_free(&node_name); return item;}
开发者ID:Barrell,项目名称:wine,代码行数:40,
示例4: read_typed_stringstatic clj_Result read_typed_string(clj_Type type, const wchar_t *prefix, clj_Reader *r) { wint_t c; StringBuffer strbuf; int escape = 0; strbuf_init(&strbuf, 80); // C'mon now, how big is your terminal? strbuf_appends(&strbuf, prefix); while (1) { c = pop_char(r); switch (c) { case WEOF: strbuf_free(&strbuf); reader_error(r, CLJ_UNEXPECTED_EOF); case L'//': strbuf_append(&strbuf, c); escape = !escape; break; case L'"': strbuf_append(&strbuf, c); if (escape) { escape = 0; break; } else { emit(r, type, strbuf.chars); strbuf_free(&strbuf); return CLJ_MORE; } default: escape = 0; strbuf_append(&strbuf, c); } }}
开发者ID:wildthink,项目名称:planck,代码行数:33,
示例5: eddsa_openssh_blobstatic void eddsa_openssh_blob(ssh_key *key, BinarySink *bs){ struct eddsa_key *ek = container_of(key, struct eddsa_key, sshk); assert(ek->curve->type == EC_EDWARDS); /* Encode the public and private points as strings */ strbuf *pub_sb = strbuf_new(); put_epoint(pub_sb, ek->publicKey, ek->curve, false); ptrlen pub = make_ptrlen(pub_sb->s + 4, pub_sb->len - 4); strbuf *priv_sb = strbuf_new_nm(); put_mp_le_unsigned(priv_sb, ek->privateKey); ptrlen priv = make_ptrlen(priv_sb->s + 4, priv_sb->len - 4); put_stringpl(bs, pub); /* Encode the private key as the concatenation of the * little-endian key integer and the public key again */ put_uint32(bs, priv.len + pub.len); put_datapl(bs, priv); put_datapl(bs, pub); strbuf_free(pub_sb); strbuf_free(priv_sb);}
开发者ID:gdh1995,项目名称:putty,代码行数:25,
示例6: cmark_free_nodes// Free a cmark_node list and any children.void cmark_free_nodes(cmark_node *e){ cmark_node *next; while (e != NULL) { strbuf_free(&e->string_content); switch (e->type){ case NODE_FENCED_CODE: strbuf_free(&e->as.code.info); break; case NODE_STRING: case NODE_INLINE_HTML: case NODE_INLINE_CODE: cmark_chunk_free(&e->as.literal); break; case NODE_LINK: case NODE_IMAGE: free(e->as.link.url); free(e->as.link.title); break; default: break; } if (e->last_child) { // Splice children into list e->last_child->next = e->next; e->next = e->first_child; } next = e->next; free(e); e = next; }}
开发者ID:rhinoman,项目名称:CommonMark,代码行数:33,
示例7: parse_hhindex/* Parse the HTML Help page corresponding to all of the Index items. * * At this high-level stage we locate out each HTML list item tag. * Since there is no end-tag for the <LI> item, we must hope that * the <LI> entry is parsed correctly or tags might get lost. * * Within each entry it is also possible to encounter an additional * <UL> tag. When this occurs the tag indicates that the topics * contained within it are related to the parent <LI> topic and * should be inset by an indent. */static void parse_hhindex(HHInfo *info, IStream *str, IndexItem *item){ stream_t stream; strbuf_t node, node_name; int indent_level = -1; strbuf_init(&node); strbuf_init(&node_name); stream_init(&stream, str); while(next_node(&stream, &node)) { get_node_name(&node, &node_name); TRACE("%s/n", node.buf); if(!strcasecmp(node_name.buf, "li")) { IndexItem *new_item; new_item = parse_li(info, &stream); if(new_item && item->keyword && strcmpW(new_item->keyword, item->keyword) == 0) { int num_items = item->nItems; item_realloc(item, num_items+1); memcpy(&item->items[num_items], &new_item->items[0], sizeof(IndexSubItem)); heap_free(new_item->keyword); heap_free(new_item->items); heap_free(new_item); } else if(new_item) { item->next = new_item; item->next->merge = item->merge; item = item->next; item->indentLevel = indent_level; } }else if(!strcasecmp(node_name.buf, "ul")) { indent_level++; }else if(!strcasecmp(node_name.buf, "/ul")) { indent_level--; }else { WARN("Unhandled tag! %s/n", node_name.buf); } strbuf_zero(&node); } strbuf_free(&node); strbuf_free(&node_name);}
开发者ID:Barrell,项目名称:wine,代码行数:59,
示例8: json_encodestatic int json_encode(lua_State *l){ json_config_t *cfg = json_fetch_config(l); strbuf_t local_encode_buf; strbuf_t *encode_buf; char *json; int len; luaL_argcheck(l, lua_gettop(l) == 1, 1, "expected 1 argument"); if (!cfg->encode_keep_buffer) { /* Use private buffer */ encode_buf = &local_encode_buf; strbuf_init(encode_buf, 0); } else { /* Reuse existing buffer */ encode_buf = &cfg->encode_buf; strbuf_reset(encode_buf); } json_append_data(l, cfg, 0, encode_buf); json = strbuf_string(encode_buf, &len); lua_pushlstring(l, json, len); if (!cfg->encode_keep_buffer) strbuf_free(encode_buf); return 1;}
开发者ID:boruis,项目名称:cocos2dx-classical,代码行数:30,
示例9: rsa_ssh1_decrypt_pkcs1bool rsa_ssh1_decrypt_pkcs1(mp_int *input, RSAKey *key, strbuf *outbuf){ strbuf *data = strbuf_new_nm(); bool success = false; BinarySource src[1]; { mp_int *b = rsa_ssh1_decrypt(input, key); for (size_t i = (mp_get_nbits(key->modulus) + 7) / 8; i-- > 0 ;) { put_byte(data, mp_get_byte(b, i)); } mp_free(b); } BinarySource_BARE_INIT(src, data->u, data->len); /* Check PKCS#1 formatting prefix */ if (get_byte(src) != 0) goto out; if (get_byte(src) != 2) goto out; while (1) { unsigned char byte = get_byte(src); if (get_err(src)) goto out; if (byte == 0) break; } /* Everything else is the payload */ success = true; put_data(outbuf, get_ptr(src), get_avail(src)); out: strbuf_free(data); return success;}
开发者ID:TortoiseGit,项目名称:TortoiseGit,代码行数:35,
示例10: k2gui_cbox_do_conversion/*** Put up dialog box to show progress and do the conversion.** Does not return until dialog box is closed.*/void k2gui_cbox_do_conversion(K2GUI *k2gui0) { int status;STRBUF *cmdline,_cmdline;cmdline=&_cmdline;strbuf_init(cmdline); k2gui = k2gui0; k2gui_cbox=&_k2gui_cbox; k2gui_cbox_init(); /* Launch conversion dialog box and start the conversion thread */ status=k2gui_cbox_create_dialog_window(k2gui->k2conv,k2gui->env,cmdline,/* k2gui->cmdline, */ &k2gui->mainwin,willusgui_instance()); if (!status) { /* Disable parent so that convert dialog is modal. */ willusgui_control_enable(&k2gui->mainwin,0); /* Process messages from conversion dialog box */ k2gui_cbox_wait_for_conversion_dialog_box_messages(); willusgui_control_enable(&k2gui->mainwin,1); k2gui_cbox_destroy(); /* Without this, the main window seems to lose focus */ willusgui_window_set_focus(&k2gui->mainwin); }strbuf_free(cmdline); }
开发者ID:Hzj-jie,项目名称:libk2pdfopt,代码行数:32,
示例11: read_filechar* read_file(char *path){ HEX_ASSERT(path); Strbuf strbuf = strbuf_create(); HEX_ASSERT(strbuf); char c; while( (c = fgetc(_f) ) != EOF ) { if(c == '/n') continue; char s[2]; memset(s, 0, sizeof(s)); snprintf(s, sizeof(s), "%c", c); strbuf_append(strbuf, s); } char *str = strdup(strbuf_cstr(strbuf)); HEX_ASSERT(str); strbuf_free(&strbuf); return str;}
开发者ID:mazj,项目名称:hex,代码行数:25,
示例12: curl_thread_donestatic void curl_thread_done(uv_work_t *w, int _) { luv_curl_t *lc = (luv_curl_t *)w->data; lua_State *L = lc->L; free(w); if (lc->stat == DOWNLOADING) lc->stat = DONE; // 1 if (lc->curl_ret == 0 && lc->retsb) { strbuf_append_char(lc->retsb, 0); lua_pushstring(L, lc->retsb->buf); } else lua_pushnil(L); if (lc->retfp) fclose(lc->retfp); // 2 getinfo(lc); push_curl_stat(lc); lua_do_global_callback(lc->L, "curl_done", lc->c, 2, 1); lua_do_global_callback(lc->L, "curl_cancel", lc->c, 0, 0); curl_easy_cleanup(lc->c); if (lc->retsb) strbuf_free(lc->retsb); if (lc->retfname) free(lc->retfname);}
开发者ID:yazengo,项目名称:gintoki,代码行数:32,
示例13: json_encodestatic int json_encode(lua_State *l){ json_config_t *cfg; char *json; int len; /* Can't use json_verify_arg_count() since we need to ensure * there is only 1 argument */ luaL_argcheck(l, lua_gettop(l) == 1, 1, "expected 1 argument"); cfg = json_fetch_config(l); cfg->current_depth = 0; /* Reset the persistent buffer if it exists. * Otherwise allocate a new buffer. */ if (strbuf_allocated(&cfg->encode_buf)) strbuf_reset(&cfg->encode_buf); else strbuf_init(&cfg->encode_buf, 0); json_append_data(l, cfg, &cfg->encode_buf); json = strbuf_string(&cfg->encode_buf, &len); lua_pushlstring(l, json, len); if (!cfg->encode_keep_buffer) strbuf_free(&cfg->encode_buf); return 1;}
开发者ID:alfishe,项目名称:redis-service,代码行数:30,
示例14: teardownvoid teardown(){ _root=NULL; fclose(_f); strbuf_free(&_strbuf); HEX_ASSERT(_strbuf == NULL);}
开发者ID:mazj,项目名称:hex,代码行数:7,
示例15: searchvoid search(bwttext * t, unsigned char * p, unsigned int l, unsigned char delimiter, int post_content) { // searching forward or backward here doesn't matter fpos_range * r = search_backward(t, p, l); //fpos_range * r = search_forward(t, p, l); if (r != NULL) { unsigned long i, p; plset * ps = plset_init(); //printf("found between f-l=%lu-%lu/n", r->first, r->last); for (i = r->first; i <= r->last; i++) { strbuf * sb1 = strbuf_init(); p = decode_forward_until(t, i, delimiter, post_content, sb1); if (!post_content) { // e.g. [xxx [yyy // could decode backward to get the ['s fpos // however, ['s order in the first column is different // from the ones in the last column // in positional BWT, the special char in the first // column is manually ordered // therefore, ['s occ in BWT != its occ in the first column // the solution here is instead to find [ in xxx[ first, // then get position of the previous one if (p == 0) p = t->char_table[1].ss - 1; // fpos of last [ else p--; // fpos of the previous [ // otherwise, // e.g. xxx/n yyy/n // decode forward to get the /n's fpos // it's normal } if (plset_contains(ps, p)) { strbuf_free(sb1); } else { strbuf * sb2 = strbuf_init(); decode_backward_until(t, i, delimiter, !post_content, sb2); plset_put(ps, p, sb2, sb1); /* strbuf_dump_rev(sb2, stdout); strbuf_dump(sb1, stdout); printf(" [pos=%lu]/n", p); */ } } plset_sort(ps); plset_print(ps, stdout); plset_free(ps); } else { fprintf(stderr, "no results found/n"); } free(r);}
开发者ID:guzhiji,项目名称:unsw-comp9319,代码行数:60,
示例16: json_encode_exceptionstatic void json_encode_exception(lua_State *l, json_config_t *cfg, strbuf_t *json, int lindex, const char *reason){ if (!cfg->encode_keep_buffer) strbuf_free(json); luaL_error(l, "Cannot serialise %s: %s", lua_typename(l, lua_type(l, lindex)), reason);}
开发者ID:boruis,项目名称:cocos2dx-classical,代码行数:8,
示例17: generate_bz_commentstaticvoid generate_bz_comment(struct strbuf *result, problem_data_t *pd, GList *comment_fmt_spec){ bool last_line_is_empty = true; GList *l = comment_fmt_spec; while (l) { section_t *sec = l->data; l = l->next; /* Skip special sections such as "%attach" */ if (sec->name[0] == '%') continue; if (sec->items) { /* "Text: item[,item]..." */ struct strbuf *output = strbuf_new(); GList *item = sec->items; while (item) { const char *str = item->data; item = item->next; if (str[0] == '-') /* "-name", ignore it */ continue; append_item(output, str, pd, comment_fmt_spec); } if (output->len != 0) { strbuf_append_strf(result, sec->name[0] ? "%s:/n%s" : "%s%s", sec->name, output->buf ); last_line_is_empty = false; } strbuf_free(output); } else { /* Just "Text" (can be "") */ /* Filter out consecutive empty lines */ if (sec->name[0] != '/0' || !last_line_is_empty) strbuf_append_strf(result, "%s/n", sec->name); last_line_is_empty = (sec->name[0] == '/0'); } } /* Nuke any trailing empty lines */ while (result->len >= 1 && result->buf[result->len-1] == '/n' && (result->len == 1 || result->buf[result->len-2] == '/n') ) { result->buf[--result->len] = '/0'; }}
开发者ID:hors,项目名称:libreport,代码行数:58,
示例18: render_nodeschar *cmark_render_ast(cmark_node *root){ char* result; strbuf buffer = GH_BUF_INIT; render_nodes(&buffer, root, -2); result = (char *)strbuf_detach(&buffer); strbuf_free(&buffer); return result;}
开发者ID:nodesman,项目名称:CommonMark,代码行数:9,
示例19: free_run_event_statevoid free_run_event_state(struct run_event_state *state){ if (state) { strbuf_free(state->command_output); free_commands(state); free(state); }}
开发者ID:scottgfhong,项目名称:libreport,代码行数:9,
示例20: htmlent_decodechar *htmlent_decode(const char *html){ bool in_ent = false; struct strbuf *buf = strbuf_init(); struct strbuf *ent = strbuf_init(); char *res; const char *dec; while (*html) { char c = *html++; if (in_ent) { strbuf_addc(ent, c); if (c == ';') { char *ent_cstr = strbuf_cstr(ent); strbuf_clear(ent); in_ent = false; dec = htmlent_table_lookup_dec(ent_cstr); amz_free(ent_cstr); if (dec != NULL) strbuf_add(buf, dec); } continue; } else if (c == '&') { in_ent = true; strbuf_addc(ent, c); continue; } strbuf_addc(buf, c); } res = strbuf_cstr(buf); strbuf_free(buf); strbuf_free(ent); return res;}
开发者ID:droptable,项目名称:amz,代码行数:43,
示例21: json_encode_descendstatic void json_encode_descend(lua_State *l, json_config_t *cfg){ cfg->current_depth++; if (cfg->current_depth > cfg->encode_max_depth) { if (!cfg->encode_keep_buffer) strbuf_free(&cfg->encode_buf); luaL_error(l, "Cannot serialise, excessive nesting (%d)", cfg->current_depth); }}
开发者ID:alfishe,项目名称:redis-service,代码行数:11,
示例22: finalize_documentcmark_node *cmark_finish(cmark_doc_parser *parser){ finalize_document(parser); strbuf_free(parser->curline);#if CMARK_DEBUG_NODES if (cmark_node_check(parser->root)) { abort(); }#endif return parser->root;}
开发者ID:Frozen-Shadow,项目名称:CommonMark,代码行数:11,
示例23: json_destroy_configstatic int json_destroy_config(lua_State *l){ struct luaL_serializer *cfg; cfg = lua_touserdata(l, 1); if (cfg) strbuf_free(&encode_buf); cfg = NULL; return 0;}
开发者ID:ocelot-inc,项目名称:tarantool,代码行数:11,
示例24: json_destroy_configstatic int json_destroy_config(lua_State *l){ json_config_t *cfg; cfg = lua_touserdata(l, 1); if (cfg) strbuf_free(&cfg->encode_buf); cfg = NULL; return 0;}
开发者ID:boruis,项目名称:cocos2dx-classical,代码行数:11,
示例25: decode_rangevoid decode_range(bwttext * t, unsigned long start_pos, unsigned long end_pos, unsigned char delimiter, int post_content, FILE * fout) { strbuf * sb; unsigned long i, l; // boundary check if (t->char_num > 1) { // position of the last record l = t->char_table[1].ss; // adjust end of the query if (end_pos > l) end_pos = l; // adjust beginning of the query if (start_pos < 1) start_pos = 1; } else if (t->char_num == 1 && t->char_table[0].c != delimiter && start_pos < 2 && end_pos > 0) { // extreme case: only one char without delimiter l = 1; start_pos = 1; end_pos = 1; } else return; for (i = start_pos; i <= end_pos; i++) { sb = strbuf_init(); if (post_content) { // - delimiter follows content, e.g. xx/n // only include the delimiter that comes after the content decode_backward_until(t, i - 1, delimiter, 0, sb); strbuf_dump_rev(sb, fout); sb->direct_out = fout; decode_forward_until(t, i - 1, delimiter, 1, sb); } else { // - delimiter is followed by content, e.g. [xx // without outputing the delimiter after the content if (i == l) // before the first (0) is the last decode_backward_until(t, 0, delimiter, 1, sb); else // before the next (i) is the current (i-1) decode_backward_until(t, i, delimiter, 1, sb); strbuf_dump_rev(sb, fout); } strbuf_free(sb); }}
开发者ID:guzhiji,项目名称:unsw-comp9319,代码行数:53,
示例26: cmark_free_blocks// Free a node_block list and any children.void cmark_free_blocks(cmark_node_block *e){ cmark_node_block * next; while (e != NULL) { cmark_free_inlines(e->inline_content); strbuf_free(&e->string_content); if (e->tag == CMARK_BLOCK_FENCED_CODE) { strbuf_free(&e->as.code.info); } else if (e->tag == CMARK_BLOCK_DOCUMENT) { reference_map_free(e->as.document.refmap); } if (e->last_child) { // Splice children into list e->last_child->next = e->next; e->next = e->children; } next = e->next; free(e); e = next; }}
开发者ID:llxwj,项目名称:CommonMark,代码行数:22,
示例27: config_closevoid config_close(struct config *config){ if (!config) return; if (config->mapped.addr) munmap(config->mapped.addr, config->mapped.sz); free(config->error_message); strbuf_free(&config->parser.strbuf); free(config);}
开发者ID:ktsaou,项目名称:lwan,代码行数:12,
注:本文中的strbuf_free函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ strbuf_init函数代码示例 C++ strbuf_detach函数代码示例 |