本文整理汇总了C++中free_all函数的典型用法代码示例。如果您正苦于以下问题:C++ free_all函数的具体用法?C++ free_all怎么用?C++ free_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了free_all函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: while
t_lex *parser(t_lex *lex)
{
t_lex *cursor;
t_detail *det_error;
t_lex *sep_error;
cursor = lex;
det_error = NULL;
sep_error = NULL;
while (cursor && !det_error)
{
if (!is_sep(cursor->str))
{
if ((cursor->lst = str_to_lst(cursor->str)) == NULL)
return (free_all(lex));
det_error = check_cmd_syntax(cursor->lst);
if (!det_error && !(det_error = check_redir(cursor->lst)))
assign_redir(cursor->lst, NULL, &det_error);
}
else
cursor->lst = NULL;
cursor = cursor->next;
}
if (det_error)
return (free_all(lex));
sep_error = check_sep_syntax(lex);
return (sep_error ? free_all(lex) : lex);
}
开发者ID:gmorer,项目名称:minishell,代码行数:28,代码来源:parser.c
示例2: read_val
void read_val(const std::string& val_fn){
std::ifstream fp;
std::stringstream ss;
std::string s;
int nx, ny, nz;
nx = n[0]; ny = n[1]; nz = n[2];
fp.open(val_fn.c_str());
if(!fp){std::cerr<<"Cannot open file with grid: "<<val_fn<<"\n"; free_all(); exit(1); }
for(int ix = 0; ix < nx+4; ix++){
for(int iy = 0; iy < ny+4; iy++){
getline(fp, s); ss.clear();
ss.str(s);
int iz = 0;
int tmp;
while(ss>>tmp){lays[ix][iy][iz] = tmp; iz++; }
if(iz != nz+4){std::cerr<<"Value file %s corrupted: layers"<<val_fn<<" "<<ix<<" "<<iy<<" "<<iz<<"\n";
free_all(); exit(1); }
}
}
for(int ip = 0; ip < 5; ip++){
for(int ix = 0; ix < nx+4; ix++){
for(int iy = 0; iy < ny+4; iy++){
getline(fp, s); ss.clear(); ss.str(s);
int iz = 0;
while(ss>>p[ip][ix][iy][iz]){ iz++; }
if(iz != nz+4){std::cerr<<"Value file "<<val_fn<<" "<<ip<<" "<<ix<<" "<<iy<<" "<<iz<<"\n";
free_all();exit(1);}
}
}
}
fp.close();
return;
}
开发者ID:aaanX11,项目名称:hydro_c,代码行数:33,代码来源:main.cpp
示例3: memory_alloc_test_thread_func
static unsigned int __stdcall memory_alloc_test_thread_func(void*)
{
allocs_info* info = new allocs_info;
info->count = 0;
info->memory = new char*[loop_count];
std::size_t count = 0;
while (count < run_count)
{
for (std::size_t i = 0; i < loop_count; ++i)
{
std::size_t size = ::rand() % (8 * 1024);
#ifdef LARGE_MEMORY
size += 20 * 1024;
#endif
#if defined(CRT_LFH) || defined(TBBMALLOC) || defined(TCMALLOC)
info->memory[i] = new char[size];
#elif defined(MS_CONCURRENCY)
info->memory[i] = reinterpret_cast<char*>(Concurrency::Alloc(size));
#elif defined(MY_ALLOCATOR)
info->memory[i] = reinterpret_cast<char*>(allocator.alloc(size));
#elif defined(JEMALLOC)
info->memory[i] = reinterpret_cast<char*>(je_malloc(size));
#endif
++info->count;
SecureZeroMemory(info->memory[i], size);
//::memset( info->memory[i], 0xff, size );
}
#ifdef OTHER_THREAD_FREE
unsigned int id = 0;
HANDLE free_thread = reinterpret_cast< HANDLE >(::_beginthreadex(nullptr, 0, memory_free_test_thread_func, info, 0, &id));
if (free_thread != nullptr)
{
::WaitForSingleObject(free_thread, INFINITE);
::CloseHandle(free_thread);
}
else
{
free_all(info);
}
#else
free_all(info);
#endif
++count;
}
delete[] info->memory;
info->memory = nullptr;
delete info;
return 0;
}
开发者ID:astromaker,项目名称:sandbox,代码行数:58,代码来源:main.cpp
示例4: exec_cmd_low_level
void exec_cmd_low_level(t_param *param, t_cmd *cmd)
{
char *path;
char *cmd_path;
if (my_strstr(cmd->arg[0], "/") == 0)
{
while ((path = get_next_path(param->env)))
{
cmd_path = xsmalloc(my_strlen(path) + my_strlen(cmd->arg[0]) + 2);
my_strcpy(cmd_path, path);
my_strcat(cmd_path, "/");
my_strcat(cmd_path, cmd->arg[0]);
xsfree(path);
if (access(cmd_path, F_OK) != -1)
execve(cmd_path, (cmd->arg), environ);
xsfree(cmd_path);
}
my_fprintf(2, "%s: command not found\n", cmd->arg[0]);
}
else
{
execve(cmd->arg[0], cmd->arg, environ);
my_fprintf(2, "%s: can't exec\n", cmd->arg[0]);
}
free_all(param);
exit(1);
}
开发者ID:DbilliT,项目名称:42sh,代码行数:28,代码来源:exec_cmd.c
示例5: main
int main(int argc, char * argv[]){
FILE *ifp,*ofp;
if(argc > 3 || argc < 2)
report_exit("error: command inputfile");
ifp = fopen(argv[1], "r") ;
ofp = fopen(argv[2], "w") ;
if( InputFile(ifp) != 1 )
report_exit("Error reading file");
char buf[80];
int i;
FILE * pFig = fopen("cluster.fig","w");
// start to test
preprocess_block(&blockage);
preprocess_sinks(&sink);
construct_g_all(&blockage,&sink);
all_pair_shortest();
cluster_sinks(&blockage,&sink);
draw_case(pFig);
draw_link_sink(pFig);
free_clusters();
free_all();
return 0;
}
开发者ID:iveney,项目名称:cts,代码行数:28,代码来源:tst_clt.c
示例6: main
int main(int ac, char **av)
{
int v;
t_map map;
t_graph **pile;
if (ac != 2)
return (1);
if (load_map(&map, av[1]) == -1 ||
create_graph(&map) == -1 ||
link_room(&map) == -1)
return (1);
if ((pile = malloc(sizeof(t_graph *))) == NULL)
return (1);
*pile = NULL;
if ((v = search_path(map.start, map.end, &pile)) == 0)
{
printf("No solution found\n");
return (1);
}
else if (v == -1)
return (2);
set_path(map.end);
show_map(&map);
free(pile);
free_all(&map);
return (0);
}
开发者ID:devillh,项目名称:Epitech_projects,代码行数:28,代码来源:main.c
示例7: main
int main()
{
int *result[2] = {NULL};
gather_results(result);
free_all(result[0], result[1]);
exit(EXIT_SUCCESS);
}
开发者ID:sphon,项目名称:CodeForge,代码行数:7,代码来源:fail.c
示例8: finalize
/* Simple finalization function */
int
finalize(thread_t * thread)
{
SOCK *sock_obj = THREAD_ARG(thread);
unsigned char digest_length = HASH_LENGTH(sock_obj);
unsigned char digest[digest_length];
int i;
/* Compute final hash digest */
HASH_FINAL(sock_obj, digest);
if (req->verbose) {
printf("\n");
printf(HTML_HASH);
dump_buffer((char *) digest, digest_length);
printf(HTML_HASH_FINAL);
}
printf("%s = ", HASH_LABEL(sock_obj));
for (i = 0; i < digest_length; i++)
printf("%02x", digest[i]);
printf("\n\n");
DBG("Finalize : [%s]\n", req->url);
free_all(thread);
return 0;
}
开发者ID:andriyanov,项目名称:keepalived,代码行数:28,代码来源:http.c
示例9: main
int main(int ac, char **av)
{
int flag_exit;
struct sockaddr_in sin;
t_init data;
g_data = &data;
signal(SIGPIPE, SIG_IGN);
signal(SIGINT, SIG_IGN);
srand(time(NULL));
if (get_option_init(ac, av, &data) == -1 || fillstruct(&sin, &data) == -1)
return (-1);
if ((bind(data.socket, (const struct sockaddr *) &sin, sizeof(sin))) == -1)
return (merror("bind"));
else
printf(STR_LISTENING, data.port);
if ((listen(data.socket, 1000)) == -1)
return (merror("listen"));
aff_options(&data);
flag_exit = 0;
signal(SIGINT, ctrl_c);
while (flag_exit != -1)
flag_exit = monitor(&data);
close(data.socket);
free_all(&data);
printf("Job done !\n");
return (EXIT_SUCCESS);
}
开发者ID:tolsac,项目名称:zappy,代码行数:28,代码来源:main.c
示例10: main
int main(int ac, char **av)
{
t_lapin *lapin;
t_bunny_pixelarray *tmp;
set_max_heap_size(30);
lapin = bunny_malloc(sizeof *lapin);
if (lapin == NULL)
return (84);
lapin->format = parse(ac, av);
if (lapin->format == 1)
tmp = load_bitmap(av[1]);
else if (lapin->format == 2)
tmp = load_ftn(av[1]);
if (lapin->format == -1)
return (1);
if (lapin->format != -1 && tmp == NULL)
tmp = NULL;
lapin->pixelarray_2 = tmp;
lapin = set_lapin(lapin);
lapin->str = av[1];
if (lapin )
bunny_set_loop_main_function(&refresh_my_game);
bunny_loop(lapin->window_1, 250, lapin);
free_all(lapin);
return (0);
}
开发者ID:mairesb,项目名称:my_epi_work,代码行数:27,代码来源:main.c
示例11: main
int main(void)
{
t_env env;
int x;
x = -1;
init_env(&env);
get_player(&env);
while (1)
{
get_map(&env);
get_piece(&env);
if (contact_play(&env, 0, 0) != 1)
{
if (play(&env, 0, 0) != 1)
{
if (simple_play(&env) != 1)
{
ft_putstr("0 0\n");
break ;
}
}
}
free_all(&env);
}
return (0);
}
开发者ID:tglaudel,项目名称:42_project,代码行数:27,代码来源:main.c
示例12: free_all
TBufferManager &TBufferManager::operator=(TBufferManager&& other)
{
free_all();
// Set input
fInputBuffer = other.fInputBuffer;
fOutputBuffer = other.fOutputBuffer;
fInput = other.fInput;
fOutput = other.fOutput;
fBufferSize = other.fBufferSize;
fSampleRate = other.fSampleRate;
// Clear output
other.fInputBuffer = nullptr;
other.fOutputBuffer = nullptr;
other.fInput = 0;
other.fOutput = 0;
other.fBufferSize = 0;
other.fSampleRate = 0;
return *this;
}
开发者ID:OSSIA,项目名称:iscore-addon-audio,代码行数:26,代码来源:TBufferManager.cpp
示例13: main
int main(){
Item* listptr;
int i;
listptr = new_item(0);
for (i=1; i < 6; i++){
listptr=insert_front(listptr, i);
}
for (i=0; i < 6; i++){
printf("i %d Item %d\n", i, get(listptr, i));
}
listptr = remove_item(listptr, 3);
for (i=0; i <= 5; i++){
printf("i %d Item %d\n", i, get(listptr, i));
}
printf("Index for 3 %d\n", get_index(listptr, 3));
for (i=1; i < 6; i++){
listptr=insert_back(listptr, i);
}
for (i=0; i < 12; i++){
printf("i %d Item %d\n", i, get(listptr, i));
}
set_item(listptr, 9, 15);
for (i=0; i < 12; i++){
printf("i %d Item %d\n", i, get(listptr, i));
}
set_item(listptr, 10, 15);
free_all(listptr);
}
开发者ID:ppgmg,项目名称:cs207labs,代码行数:29,代码来源:linked_list.c
示例14: exit_normal
void exit_normal(t_all *all, int exit_ret)
{
if (exit_ret != 42)
free_all(all);
reset_term(all);
exit(exit_ret);
}
开发者ID:y0ja,项目名称:21sh,代码行数:7,代码来源:error.c
示例15: op_end
void op_end(void)
{
if (core.flagmode.noverbose == 0)
fprintf(stdout, "%s0x%4.x%s > end\n", RED, core.memory.pc, ENDC);
free_all();
exit(EXIT_SUCCESS);
}
开发者ID:7h3rAm,项目名称:VMNDH-2k12,代码行数:7,代码来源:op_end.c
示例16: main
int main(){
// 创建客户链表头结点
PCUSTOMER_HEAD head = (PCUSTOMER_HEAD) Create_List(LIST_CUSTOMER_HEAD);
printf("Read data from the file.\n");
// 从文件中读取数据
if (ReadFromFile(head) == TRUE){
printf("Data read success.\n");
}
else{
printf("Data does not exist or read failure.\n");
}
// print_customers(head->customers);
// 显示主界面
view_main(head);
printf("\nSave the data to files.\n");
// 保存数据到文件
if (WriteToFile(head) == TRUE){
printf("Save success.\n");
}
else{
printf("Save failure.\n");
}
printf("\nRelease of lists\n");
// 释放链表
free_all(head);
return 0;
}
开发者ID:SimleCat,项目名称:assignment,代码行数:28,代码来源:main.c
示例17: epilog
/* Simple epilog functions. */
int
epilog(thread_t * thread)
{
DBG("Timeout on URL : [%s]\n", req->url);
free_all(thread);
return 0;
}
开发者ID:dencorpos,项目名称:keepalived,代码行数:8,代码来源:http.c
示例18: finalize
/* Simple finalization function */
int
finalize(thread_t * thread)
{
SOCK *sock_obj = THREAD_ARG(thread);
unsigned char digest[16];
int i;
/* Compute final MD5 digest */
MD5_Final(digest, &sock_obj->context);
if (req->verbose) {
printf("\n");
printf(HTML_MD5);
dump_buffer((char *) digest, 16);
printf(HTML_MD5_FINAL);
}
printf("MD5SUM = ");
for (i = 0; i < 16; i++)
printf("%02x", digest[i]);
printf("\n\n");
DBG("Finalize : [%s]\n", req->url);
free_all(thread);
return 0;
}
开发者ID:dencorpos,项目名称:keepalived,代码行数:26,代码来源:http.c
示例19: qobject_is_equal_num_test
static void qobject_is_equal_num_test(void)
{
QNum *u0, *i0, *d0, *dnan, *um42, *im42, *dm42;
u0 = qnum_from_uint(0u);
i0 = qnum_from_int(0);
d0 = qnum_from_double(0.0);
dnan = qnum_from_double(NAN);
um42 = qnum_from_uint((uint64_t)-42);
im42 = qnum_from_int(-42);
dm42 = qnum_from_double(-42.0);
/* Integers representing a mathematically equal number should
* compare equal */
check_equal(u0, i0);
/* Doubles, however, are always unequal to integers */
check_unequal(u0, d0);
check_unequal(i0, d0);
/* Do not assume any object is equal to itself -- note however
* that NaN cannot occur in a JSON object anyway. */
g_assert(qobject_is_equal(QOBJECT(dnan), QOBJECT(dnan)) == false);
/* No unsigned overflow */
check_unequal(um42, im42);
check_unequal(um42, dm42);
check_unequal(im42, dm42);
free_all(u0, i0, d0, dnan, um42, im42, dm42);
}
开发者ID:CRYP706URU,项目名称:pyrebox,代码行数:30,代码来源:check-qobject.c
示例20: ExecuteCommand
void ExecuteCommand(nodeT **t,char command,int key)
{
/* printf("\nExcuteCommand Hit here\n");*/
double i;
int h;
int count;
switch (toupper(command)) {
case 'I': InsertNode(t, key);break;
case 'D': printf("\n");DeleteNode(t, key);printf("\n"); break;
case 'F': printf("\n");FindNode(*t,key);printf("\n"); break;
case 'O': printf("\n");ListInOrder(*t); printf("\n");break;
case 'P': printf("\n");PreOrderWalk(*t);printf("\n"); break;
case 'A': printf("\n");PostOrderWalk(*t);printf("\n"); break;
case 'L': printf("\n");NodeLevelOrder(*t);printf("\n"); break;
case 'S': printf("\n");i=add(*t);printf("Sum of tree is:%f\n",i); break;
case 'N': printf("\n");printf("Min:");Min(*t); printf("\n");break;
case 'X': printf("\n");printf("Max:");Max(*t); printf("\n");break;
case 'T': printf("\n");h=height(*t); printf("Height:%d\n",h);break;
case 'C': printf("\n");count=Count(*t); printf("Number of inputs is:%d\n",count);break;
case 'H': printf("\n");HelpCommand(); printf("\n");break;
case 'Q': free_all(*t);exit(0);
default: printf("Illegal command\n"); break;
}
}
开发者ID:AdventureKing,项目名称:UTSASCHOOLWORK,代码行数:25,代码来源:driver.c
注:本文中的free_all函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论