本文整理汇总了C++中free_all函数的典型用法代码示例。如果您正苦于以下问题:C++ free_all函数的具体用法?C++ free_all怎么用?C++ free_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了free_all函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例7: main
int main()
{
int *result[2] = {NULL};
gather_results(result);
free_all(result[0], result[1]);
exit(EXIT_SUCCESS);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}