[Git][NTPsec/ntpsec][master] libisc: fix error clang foudn with isc__backtrace_symtable statico

Gary E. Miller gitlab at mg.gitlab.com
Sat May 27 03:13:26 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
faddd914 by Gary E. Miller at 2017-05-26T20:12:04-07:00
libisc: fix error clang foudn with isc__backtrace_symtable statico

By making isc__backtrace_symtable static clang could find the
problem.  Now obvious symtbl_compare() always return -1, so more
could could be removed.

- - - - -


1 changed file:

- libisc/backtrace.c


Changes:

=====================================
libisc/backtrace.c
=====================================
--- a/libisc/backtrace.c
+++ b/libisc/backtrace.c
@@ -26,8 +26,8 @@
  * (e.g. libisc-nosymbol.a).
  */
 
-const int isc__backtrace_nsymbols = 0;
-const isc_backtrace_symmap_t isc__backtrace_symtable[] = { { NULL, "" } };
+static const int isc__backtrace_nsymbols = 0;
+static const isc_backtrace_symmap_t isc__backtrace_symtable[] = { { NULL, "" } };
 
 #ifdef ISC_PLATFORM_USEBACKTRACE
 /*
@@ -212,8 +212,13 @@ isc_backtrace_gettrace(void **addrs, int maxaddrs, int *nframes) {
 static int
 symtbl_compare(const void *addr, const void *entryarg) {
 	const isc_backtrace_symmap_t *entry = entryarg;
-	const isc_backtrace_symmap_t *end =
-		&isc__backtrace_symtable[isc__backtrace_nsymbols - 1];
+	const isc_backtrace_symmap_t *end;
+
+        /* wow, this code never runs... */
+	if ( 0 >= isc__backtrace_nsymbols) 
+                  return -1;
+
+	end = &isc__backtrace_symtable[isc__backtrace_nsymbols - 1];
 
 	if (isc__backtrace_nsymbols == 1 || entry == end) {
 		if (addr >= entry->addr) {



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/faddd9140dd75296ed06004249e77f29ced765d0

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/faddd9140dd75296ed06004249e77f29ced765d0
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170527/f0b75ea2/attachment.html>


More information about the vc mailing list