Exemplo n.º 1
0
int init_errors(void) {
    int i;

    logg("*in init_errors\n");
    clerrors = calloc(CL_ELAST_ERROR, sizeof(*clerrors));
    if(!clerrors) {
	logg("!init_errors: failed to allocate the error array, aborting\n");
	return 1;
    }
    for(i=0; i<CL_ELAST_ERROR; i++) {
	const char *cerr = cl_strerror(i);
	wchar_t *werr;
	int len;

	if(!cerr)
	    continue;
	len = strlen(cerr)+1;
	werr = (wchar_t *)malloc(len * sizeof(wchar_t));
	if(!werr) {
	    free_errors();
	    logg("!init_errors: failed to allocate string buffer, aborting\n");
	    return 1;
	}
	if(!MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, cerr, -1, werr, len)) {
	    free_errors();
	    logg("!init_errors: failed to convert ascii error <%s> to wide, aborting\n", cerr);
	    return 1;
	}
	logg("*init_errors: error %d is %S\n", i, werr);
	clerrors[i] = werr;
    }
    return 0;
}
Exemplo n.º 2
0
void package_done(pass_opt_t* opt)
{
  codegen_shutdown(opt);

  strlist_free(search);
  search = NULL;

  strlist_free(safe);
  safe = NULL;

  package_clear_magic();

  print_errors();
  free_errors();
}