本文整理汇总了C++中FREE_AND_NULL函数的典型用法代码示例。如果您正苦于以下问题:C++ FREE_AND_NULL函数的具体用法?C++ FREE_AND_NULL怎么用?C++ FREE_AND_NULL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FREE_AND_NULL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: grep_source_clear
void grep_source_clear(struct grep_source *gs)
{
FREE_AND_NULL(gs->name);
FREE_AND_NULL(gs->path);
FREE_AND_NULL(gs->identifier);
grep_source_clear_data(gs);
}
开发者ID:niketpathak,项目名称:git,代码行数:7,代码来源:grep.c
示例2: modem_close
int modem_close(void)
{
time_t start;
conn_api.terminate=1;
if((comGetModemStatus(com)&COM_DCD)==0) /* DCD already low */
goto CLOSEIT;
/* TODO: We need a drain function */
SLEEP(500);
if(!comLowerDTR(com))
goto CLOSEIT;
start=time(NULL);
while(time(NULL)-start <= 10) {
if((comGetModemStatus(com)&COM_DCD) == 0)
goto CLOSEIT;
SLEEP(1000);
}
CLOSEIT:
while(conn_api.input_thread_running || conn_api.output_thread_running)
SLEEP(1);
comClose(com);
destroy_conn_buf(&conn_inbuf);
destroy_conn_buf(&conn_outbuf);
FREE_AND_NULL(conn_api.rd_buf);
FREE_AND_NULL(conn_api.wr_buf);
return(0);
}
开发者ID:donfanning,项目名称:syncterm,代码行数:33,代码来源:modem.c
示例3: signature_check_clear
void signature_check_clear(struct signature_check *sigc)
{
FREE_AND_NULL(sigc->payload);
FREE_AND_NULL(sigc->gpg_output);
FREE_AND_NULL(sigc->gpg_status);
FREE_AND_NULL(sigc->signer);
FREE_AND_NULL(sigc->key);
}
开发者ID:DoWonJin,项目名称:git,代码行数:8,代码来源:gpg-interface.c
示例4: refspec_item_clear
void refspec_item_clear(struct refspec_item *item)
{
FREE_AND_NULL(item->src);
FREE_AND_NULL(item->dst);
item->force = 0;
item->pattern = 0;
item->matching = 0;
item->exact_sha1 = 0;
}
开发者ID:PKRoma,项目名称:git,代码行数:9,代码来源:refspec.c
示例5: repo_clear
void repo_clear(struct repository *repo)
{
FREE_AND_NULL(repo->gitdir);
FREE_AND_NULL(repo->commondir);
FREE_AND_NULL(repo->graft_file);
FREE_AND_NULL(repo->index_file);
FREE_AND_NULL(repo->worktree);
FREE_AND_NULL(repo->submodule_prefix);
raw_object_store_clear(repo->objects);
FREE_AND_NULL(repo->objects);
if (repo->config) {
git_configset_clear(repo->config);
FREE_AND_NULL(repo->config);
}
if (repo->submodule_cache) {
submodule_cache_free(repo->submodule_cache);
repo->submodule_cache = NULL;
}
if (repo->index) {
discard_index(repo->index);
FREE_AND_NULL(repo->index);
}
}
开发者ID:DoWonJin,项目名称:git,代码行数:27,代码来源:repository.c
示例6: attr_check_clear
void attr_check_clear(struct attr_check *check)
{
FREE_AND_NULL(check->items);
check->alloc = 0;
check->nr = 0;
FREE_AND_NULL(check->all_attrs);
check->all_attrs_nr = 0;
drop_attr_stack(&check->stack);
}
开发者ID:Nowher2,项目名称:git,代码行数:11,代码来源:attr.c
示例7: serial_close
int serial_close(void)
{
conn_api.terminate=1;
while(conn_api.input_thread_running || conn_api.output_thread_running)
SLEEP(1);
comClose(com);
destroy_conn_buf(&conn_inbuf);
destroy_conn_buf(&conn_outbuf);
FREE_AND_NULL(conn_api.rd_buf);
FREE_AND_NULL(conn_api.wr_buf);
return(0);
}
开发者ID:donfanning,项目名称:syncterm,代码行数:13,代码来源:modem.c
示例8: credential_reject
void credential_reject(struct credential *c)
{
int i;
credential_apply_config(c);
for (i = 0; i < c->helpers.nr; i++)
credential_do(c, c->helpers.items[i].string, "erase");
FREE_AND_NULL(c->username);
FREE_AND_NULL(c->password);
c->approved = 0;
}
开发者ID:PEPE-coin,项目名称:git,代码行数:13,代码来源:credential.c
示例9: destroy_rules
/*---------------------------------------------------------------------------
gamma.c (destroy_rules)
----------------------------------------------------------------------------*/
void destroy_rules( RULE_PARAM * r_p ) {
if ( r_p != NULL ) {
DBG("destroy_rules 1");
FREE_AND_NULL( r_p -> rule_space ) ;
DBG("destroy_rules 2");
FREE_AND_NULL( r_p -> key_space ) ;
DBG("destroy_rules 3");
PAGC_DESTROY_2D_ARRAY(r_p->output_link,KW*,r_p->num_nodes) ;
DBG("destroy_rules 4");
PAGC_DESTROY_2D_ARRAY(r_p->gamma_matrix,NODE,r_p->num_nodes) ;
DBG(" destroy_rules 5");
FREE_AND_NULL( r_p ) ;
}
开发者ID:dengxuyue,项目名称:postgresql,代码行数:16,代码来源:gamma.c
示例10: raw_object_store_clear
void raw_object_store_clear(struct raw_object_store *o)
{
FREE_AND_NULL(o->objectdir);
FREE_AND_NULL(o->alternate_db);
oidmap_free(o->replace_map, 1);
FREE_AND_NULL(o->replace_map);
free_alt_odbs(o);
o->alt_odb_tail = NULL;
INIT_LIST_HEAD(&o->packed_git_mru);
close_all_packs(o);
o->packed_git = NULL;
}
开发者ID:PEPE-coin,项目名称:git,代码行数:15,代码来源:object.c
示例11: fetch_symref
static void fetch_symref(const char *path, char **symref, struct object_id *oid)
{
char *url = xstrfmt("%s%s", repo->url, path);
struct strbuf buffer = STRBUF_INIT;
const char *name;
if (http_get_strbuf(url, &buffer, NULL) != HTTP_OK)
die("Couldn't get %s for remote symref\n%s", url,
curl_errorstr);
free(url);
FREE_AND_NULL(*symref);
oidclr(oid);
if (buffer.len == 0)
return;
/* Cut off trailing newline. */
strbuf_rtrim(&buffer);
/* If it's a symref, set the refname; otherwise try for a sha1 */
if (skip_prefix(buffer.buf, "ref: ", &name)) {
*symref = xmemdupz(name, buffer.len - (name - buffer.buf));
} else {
get_oid_hex(buffer.buf, oid);
}
strbuf_release(&buffer);
}
开发者ID:ro-ot,项目名称:git,代码行数:29,代码来源:http-push.c
示例12: xml_start_tag
static void
xml_start_tag(void *userData, const char *name, const char **atts)
{
struct xml_ctx *ctx = (struct xml_ctx *)userData;
const char *c = strchr(name, ':');
int old_namelen, new_len;
if (c == NULL)
c = name;
else
c++;
old_namelen = strlen(ctx->name);
new_len = old_namelen + strlen(c) + 2;
if (new_len > ctx->len) {
ctx->name = xrealloc(ctx->name, new_len);
ctx->len = new_len;
}
xsnprintf(ctx->name + old_namelen, ctx->len - old_namelen, ".%s", c);
FREE_AND_NULL(ctx->cdata);
ctx->userFunc(ctx, 0);
}
开发者ID:ro-ot,项目名称:git,代码行数:25,代码来源:http-push.c
示例13: pylzma_decomp_dealloc
static void
pylzma_decomp_dealloc(CDecompressionObject *self)
{
LzmaDec_Free(&self->state, &allocator);
FREE_AND_NULL(self->unconsumed_tail);
self->ob_type->tp_free((PyObject*) self);
}
开发者ID:Stelminator,项目名称:pylzma,代码行数:7,代码来源:pylzma_decompressobj.c
示例14: graph_verify
static int graph_verify(int argc, const char **argv)
{
struct commit_graph *graph = NULL;
char *graph_name;
static struct option builtin_commit_graph_verify_options[] = {
OPT_STRING(0, "object-dir", &opts.obj_dir,
N_("dir"),
N_("The object directory to store the graph")),
OPT_END(),
};
argc = parse_options(argc, argv, NULL,
builtin_commit_graph_verify_options,
builtin_commit_graph_verify_usage, 0);
if (!opts.obj_dir)
opts.obj_dir = get_object_directory();
graph_name = get_commit_graph_filename(opts.obj_dir);
graph = load_commit_graph_one(graph_name);
FREE_AND_NULL(graph_name);
if (!graph)
return 0;
UNLEAK(graph);
return verify_commit_graph(the_repository, graph);
}
开发者ID:MichaelBlume,项目名称:git,代码行数:29,代码来源:commit-graph.c
示例15: st_add
/*
* Make a new combine_diff_path from path/mode/sha1
* and append it to paths list tail.
*
* Memory for created elements could be reused:
*
* - if last->next == NULL, the memory is allocated;
*
* - if last->next != NULL, it is assumed that p=last->next was returned
* earlier by this function, and p->next was *not* modified.
* The memory is then reused from p.
*
* so for clients,
*
* - if you do need to keep the element
*
* p = path_appendnew(p, ...);
* process(p);
* p->next = NULL;
*
* - if you don't need to keep the element after processing
*
* pprev = p;
* p = path_appendnew(p, ...);
* process(p);
* p = pprev;
* ; don't forget to free tail->next in the end
*
* p->parent[] remains uninitialized.
*/
static struct combine_diff_path *path_appendnew(struct combine_diff_path *last,
int nparent, const struct strbuf *base, const char *path, int pathlen,
unsigned mode, const struct object_id *oid)
{
struct combine_diff_path *p;
size_t len = st_add(base->len, pathlen);
size_t alloclen = combine_diff_path_size(nparent, len);
/* if last->next is !NULL - it is a pre-allocated memory, we can reuse */
p = last->next;
if (p && (alloclen > (intptr_t)p->next)) {
FREE_AND_NULL(p);
}
if (!p) {
p = xmalloc(alloclen);
/*
* until we go to it next round, .next holds how many bytes we
* allocated (for faster realloc - we don't need copying old data).
*/
p->next = (struct combine_diff_path *)(intptr_t)alloclen;
}
last->next = p;
p->path = (char *)&(p->parent[nparent]);
memcpy(p->path, base->buf, base->len);
memcpy(p->path + base->len, path, pathlen);
p->path[len] = 0;
p->mode = mode;
oidcpy(&p->oid, oid ? oid : &null_oid);
return p;
}
开发者ID:DoWonJin,项目名称:git,代码行数:65,代码来源:tree-diff.c
示例16: pylzma_decomp_dealloc
static void pylzma_decomp_dealloc(CCompatDecompressionObject *self)
{
free_lzma_stream(&self->stream);
FREE_AND_NULL(self->unconsumed_tail);
DEC_AND_NULL(self->unused_data);
PyObject_Del(self);
}
开发者ID:Cheitu,项目名称:pylzma,代码行数:7,代码来源:pylzma_decompressobj_compat.c
示例17: malloc
/* ------------------------------------------------------------
err_param.c (init_errors) :
calls : err_param.c (open_error_log), stdlib.h (malloc, free) ,
stdio.h (fprintf, fflush) stdlib.h (malloc,free)
--------------------------------------------------------------*/
ERR_PARAM *init_errors( PAGC_GLOBAL *pagc_glo_p ,
const char *log_name ) {
ERR_PARAM *err_p ;
ERR_REC *err_mem ;
err_p = ( ERR_PARAM * ) malloc( sizeof( ERR_PARAM ) ) ;
if ( err_p == NULL ) {
#ifndef NO_STDERR_OUTPUT
PRINT_ERROR( "%s\n" ,
"FATAL ERROR : Could not allocate memory for pagc_init_errors" ) ;
#endif
return NULL ;
}
/* -- set up first record -- */
RESET_ERR_P ;
/* -- a null log_name means we don't log , but collect -- */
if ( log_name == NULL ) {
err_p -> stream = NULL ;
}
else {
err_p -> stream = open_error_log( log_name ,
pagc_glo_p -> _file_sys ,
err_p ) ;
if ( err_p -> stream == NULL ) {
FREE_AND_NULL( err_p ) ;
#ifndef NO_STDERR_OUTPUT
PRINT_ERROR( "Could not create error log for pathname: %s\n" ,
log_name ) ;
#endif
return NULL ;
}
}
return err_p ;
}
开发者ID:NianYue,项目名称:pipelinedb,代码行数:40,代码来源:err_param.c
示例18: close_errors
/* ------------------------------------------------------------
err_param.c (close_errors)
uses macros BLANK_STRING, FREE_AND_NULL, and PRINT_ERROR
--------------------------------------------------------------*/
void close_errors( ERR_PARAM *err_p ) {
int is_fatal_error ;
char err_out_buf[ MAXSTRLEN ] ;
if ( err_p == NULL ) {
return ;
}
BLANK_STRING( err_out_buf ) ;
/* -- read each error into the buffer and then
output it as a single line -- */
while ( empty_errors( err_p ,
&is_fatal_error ,
err_out_buf ) ) {
if ( is_fatal_error ) {
#ifndef NO_STDERR_OUTPUT
PRINT_ERROR( "ERROR: %s\n" ,
err_out_buf ) ;
} else {
PRINT_ERROR( "%s\n" ,
err_out_buf ) ;
#endif
}
BLANK_STRING( err_out_buf ) ;
}
FREE_AND_NULL( err_p ) ;
}
开发者ID:NianYue,项目名称:pipelinedb,代码行数:33,代码来源:err_param.c
示例19: oid_array_clear
void oid_array_clear(struct oid_array *array)
{
FREE_AND_NULL(array->oid);
array->nr = 0;
array->alloc = 0;
array->sorted = 0;
}
开发者ID:Nowher2,项目名称:git,代码行数:7,代码来源:sha1-array.c
示例20: strListFree
void strListFree(str_list_t* list)
{
if(*list!=NULL) {
strListFreeStrings(*list);
FREE_AND_NULL(*list);
}
}
开发者ID:kindy,项目名称:synchronet-bbs-1,代码行数:7,代码来源:str_list.c
注:本文中的FREE_AND_NULL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论