netcdf-c/libdap2/dapdebug.c
Dennis Heimbigner 6934aa2e8b Thread safety: step 1: cleanup
re: https://github.com/Unidata/netcdf-c/issues/1373 (partial)

* Mark some global constants be const to indicate to make them easier to track.
* Hide direct access to the ncrc_globalstate behind a function call.
* Convert dispatch tables to constants (except the user defined ones)
  This has some consequences in terms of function arguments needing to be marked
  as const also.
* Remove some no longer needed global fields
* Aggregate all the globals in nclog.c
* Uniformly replace nc_sizevector{0,1} with NC_coord_{zero,one}
* Uniformly replace nc_ptrdffvector1 with NC_stride_one
* Remove some obsolete code
2019-03-30 14:06:20 -06:00

58 lines
1.2 KiB
C

/*********************************************************************
* Copyright 2018, UCAR/Unidata
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
*********************************************************************/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#include "dapincludes.h"
#include "nclog.h"
#ifdef CATCHERROR
/* Place breakpoint here to catch errors close to where they occur*/
int
dapbreakpoint(int err)
{
return err;
}
int
dapthrow(int err, int lineno, const char* filename)
{
if(err == 0) return err;
fprintf(stderr,"$dapthrow: err=%d line=%d file=%s\n",err,lineno,filename); fflush(stderr);
return dapbreakpoint(err);
}
#endif
int
dappanic(const char* fmt, ...)
{
va_list args;
if(fmt != NULL) {
va_start(args, fmt);
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n" );
va_end( args );
} else {
fprintf(stderr, "panic" );
}
fprintf(stderr, "\n" );
fflush(stderr);
return 0;
}
/*
Provide a way to print the oc full name for
an ocnode
*/
char*
ocfqn(OCddsnode node)
{
OClink conn;
oc_get_connection(node,&conn);
return makeocpathstring(conn,node,".");
}