]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
remove some unused functions
authorEvan Hunt <each@isc.org>
Fri, 10 Feb 2023 18:18:38 +0000 (10:18 -0800)
committerEvan Hunt <each@isc.org>
Mon, 13 Feb 2023 19:50:59 +0000 (11:50 -0800)
removed some functions that are no longer used and unlikely to
be resurrected, and also some that were only used to support Windows
and can now be replaced with generic versions.

12 files changed:
bin/dig/dig.c
bin/dig/dighost.h
bin/dnssec/dnssec-signzone.c
lib/dns/masterdump.c
lib/isc/dir.c
lib/isc/file.c
lib/isc/include/isc/dir.h
lib/isc/include/isc/file.h
lib/ns/include/ns/interfacemgr.h
lib/ns/include/ns/sortlist.h
lib/ns/interfacemgr.c
lib/ns/sortlist.c

index 546399c9d6524923b1eb07e3ff703014aaeaf89a..9438ae0826b053e274ee78776a04cf9db2905036 100644 (file)
@@ -3045,11 +3045,6 @@ dig_startup(void) {
        isc_loopmgr_run(loopmgr);
 }
 
-void
-dig_query_start(void) {
-       start_lookup();
-}
-
 void
 dig_shutdown(void) {
        destroy_lookup(default_lookup);
index 0b2ad0dc5dbe3cade1cdd2821ee689129f733b30..0587ce140324bacd10be51e80fe159715fa8cd02 100644 (file)
@@ -444,12 +444,6 @@ dig_query_setup(bool, bool, int argc, char **argv);
 void
 dig_startup(void);
 
-/*%
- * Initiates the next lookup cycle
- */
-void
-dig_query_start(void);
-
 /*%
  * Activate/deactivate IDN filtering of output.
  */
index 835dc2737a0e6ab22cc71c4d1bb8ea1c1f2245f7..6f2328c72e9105163ea28190f404c99724878634 100644 (file)
@@ -3913,11 +3913,7 @@ main(int argc, char *argv[]) {
                result = isc_file_mktemplate(output, tempfile, tempfilelen);
                check_result(result, "isc_file_mktemplate");
 
-               if (outputformat == dns_masterformat_text) {
-                       result = isc_file_openunique(tempfile, &outfp);
-               } else {
-                       result = isc_file_bopenunique(tempfile, &outfp);
-               }
+               result = isc_file_openunique(tempfile, &outfp);
                if (result != ISC_R_SUCCESS) {
                        fatal("failed to open temporary output file: %s",
                              isc_result_totext(result));
index d07919c41f1a14e391b77cd9dc706c71513c554b..d9cdcb786e616b3484cddd8726f79b8e311e0251 100644 (file)
@@ -1791,8 +1791,7 @@ dns_master_dumptostream(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
 }
 
 static isc_result_t
-opentmp(isc_mem_t *mctx, dns_masterformat_t format, const char *file,
-       char **tempp, FILE **fp) {
+opentmp(isc_mem_t *mctx, const char *file, char **tempp, FILE **fp) {
        FILE *f = NULL;
        isc_result_t result;
        char *tempname = NULL;
@@ -1806,11 +1805,7 @@ opentmp(isc_mem_t *mctx, dns_masterformat_t format, const char *file,
                goto cleanup;
        }
 
-       if (format == dns_masterformat_text) {
-               result = isc_file_openunique(tempname, &f);
-       } else {
-               result = isc_file_bopenunique(tempname, &f);
-       }
+       result = isc_file_openunique(tempname, &f);
        if (result != ISC_R_SUCCESS) {
                isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
                              DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR,
@@ -1846,7 +1841,7 @@ dns_master_dumpasync(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
 
        file = isc_mem_strdup(mctx, filename);
 
-       result = opentmp(mctx, format, filename, &tempname, &f);
+       result = opentmp(mctx, filename, &tempname, &f);
        if (result != ISC_R_SUCCESS) {
                goto cleanup_file;
        }
@@ -1887,7 +1882,7 @@ dns_master_dump(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
        char *tempname;
        dns_dumpctx_t *dctx = NULL;
 
-       result = opentmp(mctx, format, filename, &tempname, &f);
+       result = opentmp(mctx, filename, &tempname, &f);
        if (result != ISC_R_SUCCESS) {
                return (result);
        }
index b7eabe9a6f1db5bbaa2435b2544c918736691905..473618cb57ee2d34bec4bad689efbce1c62a42ad 100644 (file)
@@ -193,76 +193,3 @@ isc_dir_chroot(const char *dirname) {
        return (ISC_R_NOTIMPLEMENTED);
 #endif /* ifdef HAVE_CHROOT */
 }
-
-isc_result_t
-isc_dir_createunique(char *templet) {
-       isc_result_t result;
-       char *x;
-       char *p;
-       int i;
-       int pid;
-
-       REQUIRE(templet != NULL);
-
-       /*!
-        * \brief mkdtemp is not portable, so this emulates it.
-        */
-
-       pid = getpid();
-
-       /*
-        * Replace trailing Xs with the process-id, zero-filled.
-        */
-       for (x = templet + strlen(templet) - 1; *x == 'X' && x >= templet;
-            x--, pid /= 10)
-       {
-               *x = pid % 10 + '0';
-       }
-
-       x++; /* Set x to start of ex-Xs. */
-
-       do {
-               i = mkdir(templet, 0700);
-               if (i == 0 || errno != EEXIST) {
-                       break;
-               }
-
-               /*
-                * The BSD algorithm.
-                */
-               p = x;
-               while (*p != '\0') {
-                       if (isdigit((unsigned char)*p)) {
-                               *p = 'a';
-                       } else if (*p != 'z') {
-                               ++*p;
-                       } else {
-                               /*
-                                * Reset character and move to next.
-                                */
-                               *p++ = 'a';
-                               continue;
-                       }
-
-                       break;
-               }
-
-               if (*p == '\0') {
-                       /*
-                        * Tried all combinations.  errno should already
-                        * be EEXIST, but ensure it is anyway for
-                        * isc__errno2result().
-                        */
-                       errno = EEXIST;
-                       break;
-               }
-       } while (1);
-
-       if (i == -1) {
-               result = isc__errno2result(errno);
-       } else {
-               result = ISC_R_SUCCESS;
-       }
-
-       return (result);
-}
index bdf65fb460099fee9b94f8699f1810412e63a84f..a1aed8e164b7eec655d65f6ade10dd5ae7516280 100644 (file)
@@ -383,23 +383,6 @@ isc_file_openuniquemode(char *templet, int mode, FILE **fp) {
        return (result);
 }
 
-isc_result_t
-isc_file_bopenunique(char *templet, FILE **fp) {
-       int mode = S_IWUSR | S_IRUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
-       return (isc_file_openuniquemode(templet, mode, fp));
-}
-
-isc_result_t
-isc_file_bopenuniqueprivate(char *templet, FILE **fp) {
-       int mode = S_IWUSR | S_IRUSR;
-       return (isc_file_openuniquemode(templet, mode, fp));
-}
-
-isc_result_t
-isc_file_bopenuniquemode(char *templet, int mode, FILE **fp) {
-       return (isc_file_openuniquemode(templet, mode, fp));
-}
-
 isc_result_t
 isc_file_remove(const char *filename) {
        int r;
index c1ff2c7192d0e6a932f6c76d0cf979ca5aaf4397..90c327ecb448f24690537e6e5035997018b84346 100644 (file)
@@ -68,13 +68,4 @@ isc_dir_chdir(const char *dirname);
 isc_result_t
 isc_dir_chroot(const char *dirname);
 
-isc_result_t
-isc_dir_createunique(char *templet);
-/*!<
- * Use a templet (such as from isc_file_mktemplate()) to create a uniquely
- * named, empty directory.  The templet string is modified in place.
- * If result == ISC_R_SUCCESS, it is the name of the directory that was
- * created.
- */
-
 ISC_LANG_ENDDECLS
index f78c5c580c38af9585725d2860e3f722bdb4cb57..46d0f9246a20e3109fccb6bee29e4436e8bd5777 100644 (file)
@@ -102,16 +102,8 @@ isc_result_t
 isc_file_openuniqueprivate(char *templet, FILE **fp);
 isc_result_t
 isc_file_openuniquemode(char *templet, int mode, FILE **fp);
-isc_result_t
-isc_file_bopenunique(char *templet, FILE **fp);
-isc_result_t
-isc_file_bopenuniqueprivate(char *templet, FILE **fp);
-isc_result_t
-isc_file_bopenuniquemode(char *templet, int mode, FILE **fp);
 /*!<
  * \brief Create and open a file with a unique name based on 'templet'.
- *     isc_file_bopen*() open the file in binary mode in Windows.
- *     isc_file_open*() open the file in text mode in Windows.
  *
  * Notes:
  *\li  'template' is a reserved work in C++.  If you want to complain
@@ -312,8 +304,8 @@ isc_result_t
 isc_file_splitpath(isc_mem_t *mctx, const char *path, char **dirname,
                   char const **basename);
 /*%<
- * Split a path into dirname and basename.  If 'path' contains no slash
- * (or, on windows, backslash), then '*dirname' is set to ".".
+ * Split a path into dirname and basename.  If 'path' contains no slash,
+ * then '*dirname' is set to ".".
  *
  * Allocates memory for '*dirname', which can be freed with isc_mem_free().
  *
index 4c248dec232fde50efd4dca9af74e749ed70bbec..317b722405d9e72a1aa0e7513c1d0031dd0a358e 100644 (file)
@@ -127,13 +127,6 @@ ns_interfacemgr_setbacklog(ns_interfacemgr_t *mgr, int backlog);
  * Set the size of the listen() backlog queue.
  */
 
-bool
-ns_interfacemgr_islistening(ns_interfacemgr_t *mgr);
-/*%<
- * Return if the manager is listening on any interface. It can be called
- * after a scan or adjust.
- */
-
 isc_result_t
 ns_interfacemgr_scan(ns_interfacemgr_t *mgr, bool verbose, bool config);
 /*%<
index 3333e9cd499aed6de9a2c00f51db1d8e03d19acb..baac9fd16a76bb9228b92b966846dcd5265621b5 100644 (file)
@@ -66,15 +66,3 @@ ns_sortlist_addrorder2(const isc_netaddr_t *addr, const void *arg);
  * ACL forming the second element in a 2-element top-level
  * sortlist statement.
  */
-
-void
-ns_sortlist_byaddrsetup(dns_acl_t *sortlist_acl, dns_aclenv_t *env,
-                       isc_netaddr_t          *client_addr,
-                       dns_addressorderfunc_t *orderp, void **argp);
-/*%<
- * Find the sortlist statement in 'acl' that applies to 'clientaddr', if any.
- * If a sortlist statement applies, return in '*orderp' a pointer to a function
- * for ranking network addresses based on that sortlist statement, and in
- * '*argp' an argument to pass to said function.  If no sortlist statement
- * applies, set '*orderp' and '*argp' to NULL.
- */
index d10f41c0c208d1b50b2bce1f3d878d9d229ac5fc..c159369a64b958b26bf41c4b1d7cd0449588aaa1 100644 (file)
@@ -1349,13 +1349,6 @@ ns_interfacemgr_scan(ns_interfacemgr_t *mgr, bool verbose, bool config) {
        return (result);
 }
 
-bool
-ns_interfacemgr_islistening(ns_interfacemgr_t *mgr) {
-       REQUIRE(NS_INTERFACEMGR_VALID(mgr));
-
-       return (ISC_LIST_EMPTY(mgr->interfaces) ? false : true);
-}
-
 void
 ns_interfacemgr_setlistenon4(ns_interfacemgr_t *mgr, ns_listenlist_t *value) {
        REQUIRE(NS_INTERFACEMGR_VALID(mgr));
index 2aada90b196edb996ad7a712f514afca0d2f3fa6..971edb60d2b07d6a8ddb590d722d0b61ad282a1b 100644 (file)
@@ -153,29 +153,3 @@ ns_sortlist_addrorder1(const isc_netaddr_t *addr, const void *arg) {
 
        return (INT_MAX);
 }
-
-void
-ns_sortlist_byaddrsetup(dns_acl_t *sortlist_acl, dns_aclenv_t *env,
-                       isc_netaddr_t *client_addr,
-                       dns_addressorderfunc_t *orderp, void **argp) {
-       ns_sortlisttype_t sortlisttype;
-
-       sortlisttype = ns_sortlist_setup(sortlist_acl, env, client_addr, argp);
-
-       switch (sortlisttype) {
-       case NS_SORTLISTTYPE_1ELEMENT:
-               *orderp = ns_sortlist_addrorder1;
-               break;
-       case NS_SORTLISTTYPE_2ELEMENT:
-               *orderp = ns_sortlist_addrorder2;
-               break;
-       case NS_SORTLISTTYPE_NONE:
-               *orderp = NULL;
-               break;
-       default:
-               UNEXPECTED_ERROR(
-                       "unexpected return from ns_sortlist_setup(): %d",
-                       sortlisttype);
-               break;
-       }
-}