From e148b73013109517c4d179aa9ae5a50b6d1dd5b5 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Thu, 4 Jun 2020 18:07:38 +0100 Subject: libctf: drop error-prone ctf_strerror This utility function is almost useless (all it does is casts the result of a strerror) but has a seriously confusing name. Over and over again I have accidentally called it instead of ctf_errmsg, and hidden a time-bomb for myself in a hard-to-test error-handling path: since ctf_strerror is just a strerror wrapper, it cannot handle CTF errnos, unlike ctf_errmsg. It's astonishingly lucky that none of these errors have crept into any commits to date. Fuse it into ctf_errmsg and drop it. libctf/ * ctf-impl.h (ctf_strerror): Delete. * ctf-subr.c (ctf_strerror): Likewise. * ctf-error.c (ctf_errmsg): Stop using ctf_strerror: just use strerror directly. --- libctf/ctf-impl.h | 1 - 1 file changed, 1 deletion(-) (limited to 'libctf/ctf-impl.h') diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h index 4c8a37c..71b732a 100644 --- a/libctf/ctf-impl.h +++ b/libctf/ctf-impl.h @@ -548,7 +548,6 @@ extern ssize_t ctf_pread (int fd, void *buf, ssize_t count, off_t offset); extern void *ctf_realloc (ctf_file_t *, void *, size_t); extern char *ctf_str_append (char *, const char *); extern char *ctf_str_append_noerr (char *, const char *); -extern const char *ctf_strerror (int); extern ctf_id_t ctf_type_resolve_unsliced (ctf_file_t *, ctf_id_t); extern int ctf_type_kind_unsliced (ctf_file_t *, ctf_id_t); -- cgit v1.1