chiark
/
gitweb
/
~ianmdlvl
/
adns.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
adns_str* etc.: Return NULL rather than crashing, and docs
[adns.git]
/
src
/
general.c
diff --git
a/src/general.c
b/src/general.c
index e2ab3bc1854a155f2c83d41967f1e8e8194e5ccf..cfe07bddbb5653b349d1f73c477e8ef72c174bd7 100644
(file)
--- a/
src/general.c
+++ b/
src/general.c
@@
-288,14
+288,14
@@
const char *adns_strerror(adns_status st) {
const struct sinfo *si;
si= findsinfo(st);
const struct sinfo *si;
si= findsinfo(st);
- return si
->string
;
+ return si
? si->string : 0
;
}
const char *adns_errabbrev(adns_status st) {
const struct sinfo *si;
si= findsinfo(st);
}
const char *adns_errabbrev(adns_status st) {
const struct sinfo *si;
si= findsinfo(st);
- return si
->abbrev
;
+ return si
? si->abbrev : 0
;
}
}
@@
-332,7
+332,7
@@
const char *adns_errtypeabbrev(adns_status st) {
sti= bsearch(&st,stinfos, sizeof(stinfos)/sizeof(*stinfos),
sizeof(*stinfos), sti_compar);
sti= bsearch(&st,stinfos, sizeof(stinfos)/sizeof(*stinfos),
sizeof(*stinfos), sti_compar);
- return sti
->abbrev
;
+ return sti
? sti->abbrev : 0
;
}
}