- // For thread safety on linux (and most unix systems), we need
- // to use the reentrant version of the error translation
- // function. Microsoft's strerror() is thread safe, since it
- // returns a pointer to thread local storage. Unfortunately
- // there several different reentrant versions. Here, we check
- // for glibc, since we are using gcc. It appears at least the
- // current version of gcc has strerror_r() available by
- // default.
- #ifdef __GLIBC__
- char buf[1024];
- // PJD: result not necessarily equal to buf
- const char* result = strerror_r(code, buf, sizeof(buf));
- if (result != 0)
- return result;
- return exception::errmsg();
- #else
- return strerror(code);
- #endif
+ // For thread safety on linux (and most unix systems), we need
+ // to use the reentrant version of the error translation
+ // function. Microsoft's strerror() is thread safe, since it
+ // returns a pointer to thread local storage. Unfortunately
+ // there several different reentrant versions. Here, we check
+ // for glibc, since we are using gcc. It appears at least the
+ // current version of gcc has strerror_r() available by
+ // default.
+ #ifdef __GLIBC__
+ char buf[1024];
+ // PJD: result not necessarily equal to buf
+ const char* result = strerror_r(code, buf, sizeof(buf));
+ if (result != 0)
+ return result;
+ return exception::errmsg();
+ #else
+ return strerror(code);
+ #endif
- exception(errcode), info(addinfo) {
- // std::cerr << "WARNING: made bib1Exception(" << errcode << "=" <<
- // ZOOM_diag_str(errcode) << ", '" << addinfo << "')\n";
+ exception(errcode), info(addinfo) {
+ // std::cerr << "WARNING: made bib1Exception(" << errcode << "=" <<
+ // ZOOM_diag_str(errcode) << ", '" << addinfo << "')\n";
- //fprintf(stderr, "deleting bib1Exception 0x%lx (%d, 0x%lx=%s)\n",
- //(long) this, code, (long) info, info);
- //delete info;
- // ### Don't actually do the deletion for now. Exception
- // reference semantics are too weird for me to grok so I'm
- // doing The Wrong Thing in the knowledge that it will more
- // or less work -- it just leaks memory. (Or does it?)
+ //fprintf(stderr, "deleting bib1Exception 0x%lx (%d, 0x%lx=%s)\n",
+ //(long) this, code, (long) info, info);
+ //delete info;
+ // ### Don't actually do the deletion for now. Exception
+ // reference semantics are too weird for me to grok so I'm
+ // doing The Wrong Thing in the knowledge that it will more
+ // or less work -- it just leaks memory. (Or does it?)
- switch (code) {
- case PREFIX: return "bad prefix search";
- case CCL: return "bad CCL search";
- default: break;
- }
- return "bad search (unknown type)";
+ switch (code) {
+ case PREFIX: return "bad prefix search";
+ case CCL: return "bad CCL search";
+ default: break;
+ }
+ return "bad search (unknown type)";