From 130fd4794b7f96b32556f9ce48552ea645391a79 Mon Sep 17 00:00:00 2001 From: Brad House Date: Mon, 22 Jul 2024 13:22:51 -0400 Subject: [PATCH] Reorganize source tree (#822) c-ares is getting larger these days and we keep adding source files to the same directory so it can be hard to differentiate core c-ares implementation from library/utility functions. Lets make some subdirectories to help with that and shuffle files around. Fix By: Brad House (@bradh352) --- .cirrus.yml | 23 ++-- .github/workflows/coveralls.yml | 38 ++++++ CMakeLists.txt | 24 ++++ Makefile.Watcom | 60 +++++++++ Makefile.dj | 29 +++-- Makefile.msvc | 44 +++++-- appveyor.yml | 6 - src/lib/Makefile.inc | 114 +++++++++--------- src/lib/ares_destroy.c | 2 +- src/lib/ares_init.c | 2 +- src/lib/ares_private.h | 26 ++-- src/lib/{ => dsa}/ares__htable.c | 0 src/lib/{ => dsa}/ares__htable.h | 0 src/lib/{ => dsa}/ares__htable_asvp.c | 0 src/lib/{ => dsa}/ares__htable_asvp.h | 0 src/lib/{ => dsa}/ares__htable_strvp.c | 0 src/lib/{ => dsa}/ares__htable_strvp.h | 0 src/lib/{ => dsa}/ares__htable_szvp.c | 0 src/lib/{ => dsa}/ares__htable_szvp.h | 0 src/lib/{ => dsa}/ares__htable_vpvp.c | 0 src/lib/{ => dsa}/ares__htable_vpvp.h | 0 src/lib/{ => dsa}/ares__llist.c | 0 src/lib/{ => dsa}/ares__llist.h | 0 src/lib/{ => dsa}/ares__slist.c | 0 src/lib/{ => dsa}/ares__slist.h | 0 src/lib/{ => event}/ares_event.h | 0 src/lib/{ => event}/ares_event_configchg.c | 0 src/lib/{ => event}/ares_event_epoll.c | 0 src/lib/{ => event}/ares_event_kqueue.c | 0 src/lib/{ => event}/ares_event_poll.c | 0 src/lib/{ => event}/ares_event_select.c | 0 src/lib/{ => event}/ares_event_thread.c | 0 src/lib/{ => event}/ares_event_wake_pipe.c | 0 src/lib/{ => event}/ares_event_win32.c | 0 src/lib/{ => event}/ares_event_win32.h | 0 src/lib/{ => legacy}/ares_create_query.c | 0 src/lib/{ => legacy}/ares_expand_name.c | 0 src/lib/{ => legacy}/ares_expand_string.c | 0 src/lib/{ => legacy}/ares_fds.c | 0 src/lib/{ => legacy}/ares_getsock.c | 0 src/lib/{ => legacy}/ares_parse_a_reply.c | 0 src/lib/{ => legacy}/ares_parse_aaaa_reply.c | 0 src/lib/{ => legacy}/ares_parse_caa_reply.c | 0 src/lib/{ => legacy}/ares_parse_mx_reply.c | 0 src/lib/{ => legacy}/ares_parse_naptr_reply.c | 0 src/lib/{ => legacy}/ares_parse_ns_reply.c | 0 src/lib/{ => legacy}/ares_parse_ptr_reply.c | 0 src/lib/{ => legacy}/ares_parse_soa_reply.c | 0 src/lib/{ => legacy}/ares_parse_srv_reply.c | 0 src/lib/{ => legacy}/ares_parse_txt_reply.c | 0 src/lib/{ => legacy}/ares_parse_uri_reply.c | 0 src/lib/{ => str}/ares__buf.c | 0 src/lib/{ => str}/ares__buf.h | 0 src/lib/{ => str}/ares_str.c | 0 src/lib/{ => str}/ares_str.h | 0 src/lib/{ => str}/ares_strcasecmp.c | 0 src/lib/{ => str}/ares_strcasecmp.h | 0 src/lib/{ => str}/ares_strsplit.c | 0 src/lib/{ => str}/ares_strsplit.h | 0 src/lib/{ => util}/ares__iface_ips.c | 0 src/lib/{ => util}/ares__iface_ips.h | 0 src/lib/{ => util}/ares__threads.c | 0 src/lib/{ => util}/ares__threads.h | 0 src/lib/{ => util}/ares_math.c | 0 src/lib/{ => util}/ares_rand.c | 0 src/tools/Makefile.inc | 4 +- src/tools/adig.c | 6 +- src/tools/ahost.c | 6 +- test/ares-test-internal.cc | 4 +- test/ares-test.cc | 2 +- 70 files changed, 271 insertions(+), 119 deletions(-) create mode 100644 .github/workflows/coveralls.yml rename src/lib/{ => dsa}/ares__htable.c (100%) rename src/lib/{ => dsa}/ares__htable.h (100%) rename src/lib/{ => dsa}/ares__htable_asvp.c (100%) rename src/lib/{ => dsa}/ares__htable_asvp.h (100%) rename src/lib/{ => dsa}/ares__htable_strvp.c (100%) rename src/lib/{ => dsa}/ares__htable_strvp.h (100%) rename src/lib/{ => dsa}/ares__htable_szvp.c (100%) rename src/lib/{ => dsa}/ares__htable_szvp.h (100%) rename src/lib/{ => dsa}/ares__htable_vpvp.c (100%) rename src/lib/{ => dsa}/ares__htable_vpvp.h (100%) rename src/lib/{ => dsa}/ares__llist.c (100%) rename src/lib/{ => dsa}/ares__llist.h (100%) rename src/lib/{ => dsa}/ares__slist.c (100%) rename src/lib/{ => dsa}/ares__slist.h (100%) rename src/lib/{ => event}/ares_event.h (100%) rename src/lib/{ => event}/ares_event_configchg.c (100%) rename src/lib/{ => event}/ares_event_epoll.c (100%) rename src/lib/{ => event}/ares_event_kqueue.c (100%) rename src/lib/{ => event}/ares_event_poll.c (100%) rename src/lib/{ => event}/ares_event_select.c (100%) rename src/lib/{ => event}/ares_event_thread.c (100%) rename src/lib/{ => event}/ares_event_wake_pipe.c (100%) rename src/lib/{ => event}/ares_event_win32.c (100%) rename src/lib/{ => event}/ares_event_win32.h (100%) rename src/lib/{ => legacy}/ares_create_query.c (100%) rename src/lib/{ => legacy}/ares_expand_name.c (100%) rename src/lib/{ => legacy}/ares_expand_string.c (100%) rename src/lib/{ => legacy}/ares_fds.c (100%) rename src/lib/{ => legacy}/ares_getsock.c (100%) rename src/lib/{ => legacy}/ares_parse_a_reply.c (100%) rename src/lib/{ => legacy}/ares_parse_aaaa_reply.c (100%) rename src/lib/{ => legacy}/ares_parse_caa_reply.c (100%) rename src/lib/{ => legacy}/ares_parse_mx_reply.c (100%) rename src/lib/{ => legacy}/ares_parse_naptr_reply.c (100%) rename src/lib/{ => legacy}/ares_parse_ns_reply.c (100%) rename src/lib/{ => legacy}/ares_parse_ptr_reply.c (100%) rename src/lib/{ => legacy}/ares_parse_soa_reply.c (100%) rename src/lib/{ => legacy}/ares_parse_srv_reply.c (100%) rename src/lib/{ => legacy}/ares_parse_txt_reply.c (100%) rename src/lib/{ => legacy}/ares_parse_uri_reply.c (100%) rename src/lib/{ => str}/ares__buf.c (100%) rename src/lib/{ => str}/ares__buf.h (100%) rename src/lib/{ => str}/ares_str.c (100%) rename src/lib/{ => str}/ares_str.h (100%) rename src/lib/{ => str}/ares_strcasecmp.c (100%) rename src/lib/{ => str}/ares_strcasecmp.h (100%) rename src/lib/{ => str}/ares_strsplit.c (100%) rename src/lib/{ => str}/ares_strsplit.h (100%) rename src/lib/{ => util}/ares__iface_ips.c (100%) rename src/lib/{ => util}/ares__iface_ips.h (100%) rename src/lib/{ => util}/ares__threads.c (100%) rename src/lib/{ => util}/ares__threads.h (100%) rename src/lib/{ => util}/ares_math.c (100%) rename src/lib/{ => util}/ares_rand.c (100%) diff --git a/.cirrus.yml b/.cirrus.yml index b847d9eb..343a76e3 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -7,6 +7,7 @@ env: CMAKE_TEST_FLAGS: "-DCARES_BUILD_TESTS=ON" task: + skip: "changesIncludeOnly('doc/*', '.github/*', 'appveyor.yml', '*.md', 'Makefile.watcom', 'Makefile.dj', 'Makefile.msvc', 'Makefile.m32')" matrix: - name: "Debian amd64" env: @@ -151,17 +152,17 @@ task: BUILD_TYPE: "valgrind" TEST_WRAP: "valgrind --leak-check=full" TEST_FILTER: "--gtest_filter=-*Container*:-*LiveSearchANY*" - - name: "COVERAGE" - only_if: $BUILD_COVERAGE == 'yes' - env: - BUILD_TYPE: "coverage" - CI_NAME: "cirrus-ci" - CI_BUILD_NUMBER: "${CIRRUS_TASK_ID}" - CI_BUILD_URL: "https://cirrus-ci.com/task/${CIRRUS_TASK_ID}" - CI_BRANCH: "${CIRRUS_BRANCH}" - CI_PULL_REQUEST: "${CIRRUS_PR}" - COVERALLS_REPO_TOKEN: "ENCRYPTED[a46bc6ca908e9e74f102c686cde67cae21d3e792dff46a60e860d1179d9349e8eb5a529132d0effefebdb0dbc3f95810]" - CONFIG_OPTS: "--enable-debug --disable-shared --enable-code-coverage --enable-tests" +# - name: "COVERAGE" +# only_if: $BUILD_COVERAGE == 'yes' +# env: +# BUILD_TYPE: "coverage" +# CI_NAME: "cirrus-ci" +# CI_BUILD_NUMBER: "${CIRRUS_TASK_ID}" +# CI_BUILD_URL: "https://cirrus-ci.com/task/${CIRRUS_TASK_ID}" +# CI_BRANCH: "${CIRRUS_BRANCH}" +# CI_PULL_REQUEST: "${CIRRUS_PR}" +# COVERALLS_REPO_TOKEN: "ENCRYPTED[a46bc6ca908e9e74f102c686cde67cae21d3e792dff46a60e860d1179d9349e8eb5a529132d0effefebdb0dbc3f95810]" +# CONFIG_OPTS: "--enable-debug --disable-shared --enable-code-coverage --enable-tests" install_script: - | diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml new file mode 100644 index 00000000..6c836ffa --- /dev/null +++ b/.github/workflows/coveralls.yml @@ -0,0 +1,38 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT +name: Coveralls +on: + push: + pull_request: + +jobs: + build: + name: Coveralls + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: lcov libgmock-dev ninja-build + version: 1.0 + - name: Build + run: | + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=DEBUG -DCARES_BUILD_TESTS=ON -DCARES_COVERAGE=ON -DCARES_BUILD_TOOLS=OFF -G Ninja .. + ninja + - name: Test + shell: bash + run: | + cd build + ./bin/arestest -v -4 --gtest_filter='-*LiveSearchTXT*:*LiveSearchANY*' + - name: Generate Coverage + shell: bash + run: | + cd build + ninja coverage + - name: Upload to Coveralls + uses: coverallsapp/github-action@master + with: + path-to-lcov: ${{runner.workspace}}/c-ares/build/coverage.info + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index c0c995a3..f09cbb82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ OPTION (CARES_BUILD_CONTAINER_TESTS "Build and run container tests (implies CARE OPTION (CARES_BUILD_TOOLS "Build tools" ON) OPTION (CARES_SYMBOL_HIDING "Hide private symbols in shared libraries" OFF) OPTION (CARES_THREADS "Build with thread-safety support" ON) +OPTION (CARES_COVERAGE "Build for code coverage" OFF) SET (CARES_RANDOM_FILE "/dev/urandom" CACHE STRING "Suitable File / Device Path for entropy, such as /dev/urandom") @@ -682,6 +683,27 @@ IF (HAVE_ARPA_NAMESER_COMPAT_H) SET (CARES_HAVE_ARPA_NAMESER_COMPAT_H 1) ENDIF() + +# Coverage +IF (CARES_COVERAGE) + # set compiler flags + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs") + + # find required tools + FIND_PROGRAM(LCOV lcov REQUIRED) + FIND_PROGRAM(GENHTML genhtml REQUIRED) + + # add coverage target + ADD_CUSTOM_TARGET(coverage + # gather data + COMMAND ${LCOV} --directory . --capture --output-file coverage.info + # generate report + COMMAND ${GENHTML} --demangle-cpp -o coverage coverage.info + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) +ENDIF() + # TRANSFORM_MAKEFILE_INC # # This function consumes the "Makefile.inc" autotools file, and converts it into @@ -729,6 +751,8 @@ IF (CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS) ENDIF () + + # Export targets IF (CARES_INSTALL) SET (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") diff --git a/Makefile.Watcom b/Makefile.Watcom index f6eb7c07..7d67deb4 100644 --- a/Makefile.Watcom +++ b/Makefile.Watcom @@ -97,7 +97,17 @@ all: $(ARESBUILDH) $(OBJ_BASE) $(TARGETS) $(DEMOS) .SYMBOLIC $(OBJ_BASE): -$(MD) $^@ -$(MD) $^@\stat + -$(MD) $^@\stat\dsa + -$(MD) $^@\stat\event + -$(MD) $^@\stat\legacy + -$(MD) $^@\stat\str + -$(MD) $^@\stat\util -$(MD) $^@\dyn + -$(MD) $^@\dyn\dsa + -$(MD) $^@\dyn\event + -$(MD) $^@\dyn\legacy + -$(MD) $^@\dyn\str + -$(MD) $^@\dyn\util -$(MD) $^@\tools $(ARESBUILDH): .EXISTSONLY @@ -129,7 +139,17 @@ vclean realclean: clean .SYMBOLIC -$(RM) $(TARGETS) $(LIBNAME).map -$(RM) $(DEMOS) $(DEMOS:.exe=.map) -$(RD) $(OBJ_BASE)\stat + -$(RD) $(OBJ_BASE)\stat\dsa + -$(RD) $(OBJ_BASE)\stat\event + -$(RD) $(OBJ_BASE)\stat\legacy + -$(RD) $(OBJ_BASE)\stat\str + -$(RD) $(OBJ_BASE)\stat\util -$(RD) $(OBJ_BASE)\dyn + -$(RD) $(OBJ_BASE)\dyn\dsa + -$(RD) $(OBJ_BASE)\dyn\event + -$(RD) $(OBJ_BASE)\dyn\legacy + -$(RD) $(OBJ_BASE)\dyn\str + -$(RD) $(OBJ_BASE)\dyn\util -$(RD) $(OBJ_BASE)\tools -$(RD) $(OBJ_BASE) @@ -144,10 +164,50 @@ $(RESOURCE): src\lib\cares.rc .AUTODEPEND .c{$(OBJ_BASE)\dyn}.obj: $(CC) $(CFLAGS) -bd .\src\lib\$^& -fo=$^@ +.ERASE +{dsa}.c{$(OBJ_BASE)\dyn\dsa}.obj: + $(CC) $(CFLAGS) -bd .\src\lib\dsa\$^& -fo=$^@ + +.ERASE +{event}.c{$(OBJ_BASE)\dyn\event}.obj: + $(CC) $(CFLAGS) -bd .\src\lib\event\$^& -fo=$^@ + +.ERASE +{legacy}.c{$(OBJ_BASE)\dyn\legacy}.obj: + $(CC) $(CFLAGS) -bd .\src\lib\legacy\$^& -fo=$^@ + +.ERASE +{str}.c{$(OBJ_BASE)\dyn\str}.obj: + $(CC) $(CFLAGS) -bd .\src\lib\str\$^& -fo=$^@ + +.ERASE +{util}.c{$(OBJ_BASE)\dyn\util}.obj: + $(CC) $(CFLAGS) -bd .\src\lib\util\$^& -fo=$^@ + .ERASE .c{$(OBJ_BASE)\stat}.obj: $(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\$^& -fo=$^@ +.ERASE +{dsa}.c{$(OBJ_BASE)\stat\dsa}.obj: + $(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\dsa\$^& -fo=$^@ + +.ERASE +{event}.c{$(OBJ_BASE)\stat\event}.obj: + $(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\event\$^& -fo=$^@ + +.ERASE +{legacy}.c{$(OBJ_BASE)\stat\legacy}.obj: + $(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\legacy\$^& -fo=$^@ + +.ERASE +{str}.c{$(OBJ_BASE)\stat\str}.obj: + $(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\str\$^& -fo=$^@ + +.ERASE +{util}.c{$(OBJ_BASE)\stat\util}.obj: + $(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\util\$^& -fo=$^@ + $(LINK_ARG): $(__MAKEFILES__) %create $^@ @%append $^@ system nt dll diff --git a/Makefile.dj b/Makefile.dj index c28aefe9..dae55609 100644 --- a/Makefile.dj +++ b/Makefile.dj @@ -5,8 +5,14 @@ # include src/lib/Makefile.inc -CSOURCES := $(addprefix src/lib/, $(CSOURCES)) -CSOURCES := $(filter-out src/lib/windows_port.c, $(CSOURCES)) +OBJ_DIR = djgpp +OBJECTS = $(addprefix $(OBJ_DIR)/, \ + $(CSOURCES:.c=.o)) + +CSRC = $(addprefix src/lib/, $(CSOURCES)) +#CSRC := $(filter-out src/lib/windows_port.c, $(CSOURCES)) + +OBJ_SUBDIRS = $(OBJ_DIR)/dsa $(OBJ_DIR)/event $(OBJ_DIR)/legacy $(OBJ_DIR)/str $(OBJ_DIR)/util VPATH = src/lib src/tools @@ -17,8 +23,6 @@ VPATH = src/lib src/tools WATT32_ROOT = $(realpath $(WATT_ROOT)) WATT32_LIB = $(WATT32_ROOT)/lib/libwatt.a -OBJ_DIR = djgpp - CFLAGS = -g -O2 -I./include -I./src/lib \ -I$(WATT32_ROOT)/inc \ -Wall \ @@ -82,9 +86,6 @@ else CC = gcc endif -OBJECTS = $(addprefix $(OBJ_DIR)/, \ - $(notdir $(CSOURCES:.c=.o))) - GENERATED = src/lib/ares_config.h \ include/ares_build.h @@ -92,7 +93,7 @@ TARGETS = libcares.a adig.exe ahost.exe .SECONDARY: $(OBJ_DIR)/ares_getopt.o -all: $(OBJ_DIR) $(GENERATED) $(TARGETS) +all: $(OBJ_DIR) $(OBJ_SUBDIRS) $(GENERATED) $(TARGETS) @echo Welcome to c-ares. libcares.a: $(OBJECTS) @@ -111,15 +112,19 @@ include/ares_build.h: include/ares_build.h.dist # clean: - rm -f depend.dj $(GENERATED) $(OBJ_DIR)/*.o - - rmdir $(OBJ_DIR) + - rmdir $(OBJ_SUBDIRS) # Clean everything # realclean vclean: clean - rm -f $(TARGETS) $(TARGETS:.exe=.map) -$(OBJ_DIR): - - mkdir $@ +.PHONY: obj_subdirs $(OBJ_SUBDIRS) + +obj_subdirs: $(OBJ_SUBDIRS) + +$(OBJ_SUBDIRS): + mkdir $@ $(OBJ_DIR)/%.o: %.c $(CC) $(CFLAGS) -o $@ -c $< @@ -138,7 +143,7 @@ DEP_REPLACE = sed -e 's@\(.*\)\.o: @\n$$(OBJ_DIR)\/\1.o: @' \ # a foreign 'curl_config.h' is making trouble. # depend: $(GENERATED) Makefile.dj - $(CC) -MM $(CFLAGS) $(CSOURCES) | $(DEP_REPLACE) > depend.dj + $(CC) -MM $(CFLAGS) $(CSRC) | $(DEP_REPLACE) > depend.dj -include depend.dj diff --git a/Makefile.msvc b/Makefile.msvc index 4b338f27..7f0c38e6 100644 --- a/Makefile.msvc +++ b/Makefile.msvc @@ -299,6 +299,7 @@ RC_CMD = $(RC_CMD_DBG) !ERROR Problem generating CARES_OBJS list. !ENDIF CARES_OBJS = $(CARES_OBJS:.c=.obj) +CARES_OBJS = $(CARES_OBJS:/=\) !IF "$(USE_RES_FILE)" == "TRUE" CARES_OBJS = $(CARES_OBJS) $(CARES_OBJDIR)\cares.res !ENDIF @@ -341,20 +342,35 @@ PROG3_OBJS = $(PROG3_OBJS) $(PROG3_OBJDIR)\ahost.obj {$(SRCDIR)\src\lib}.c{$(CARES_OBJDIR)}.obj: $(CC_CMD) $(CC_CFLAGS) $(CARES_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< +{$(SRCDIR)\src\lib\dsa}.c{$(CARES_OBJDIR)\dsa}.obj: + $(CC_CMD) $(CC_CFLAGS) $(CARES_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< + +{$(SRCDIR)\src\lib\event}.c{$(CARES_OBJDIR)\event}.obj: + $(CC_CMD) $(CC_CFLAGS) $(CARES_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< + +{$(SRCDIR)\src\lib\legacy}.c{$(CARES_OBJDIR)\legacy}.obj: + $(CC_CMD) $(CC_CFLAGS) $(CARES_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< + +{$(SRCDIR)\src\lib\str}.c{$(CARES_OBJDIR)\str}.obj: + $(CC_CMD) $(CC_CFLAGS) $(CARES_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< + +{$(SRCDIR)\src\lib\util}.c{$(CARES_OBJDIR)\util}.obj: + $(CC_CMD) $(CC_CFLAGS) $(CARES_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< + {$(SRCDIR)\src\tools}.c{$(PROG2_OBJDIR)}.obj: - $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< + $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(PROG2_OBJDIR)\ /c $< {$(SRCDIR)\src\tools}.c{$(PROG3_OBJDIR)}.obj: - $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< + $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(PROG3_OBJDIR)\ /c $< -# Hack Alert! we reference ../lib/ files in the Makefile.inc for tools as they +# Hack Alert! we reference ../lib/str files in the Makefile.inc for tools as they # share some files with the library itself. We need to hack around that here. -{$(SRCDIR)\src\lib}.c{$(PROG2_OBJDIR)\..\lib}.obj: - $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG2_OBJDIR)\$(@F) /Fd$(PROG2_OBJDIR)\ /c $< +{$(SRCDIR)\src\lib\str}.c{$(PROG2_OBJDIR)\..\lib\str}.obj: + $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG2_OBJDIR)\str\$(@F) /Fd$(PROG2_OBJDIR)\str\ /c $< -{$(SRCDIR)\src\lib}.c{$(PROG3_OBJDIR)\..\lib}.obj: - $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG3_OBJDIR)\$(@F) /Fd$(PROG3_OBJDIR)\ /c $< +{$(SRCDIR)\src\lib\str}.c{$(PROG3_OBJDIR)\..\lib\str}.obj: + $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG3_OBJDIR)\str\$(@F) /Fd$(PROG3_OBJDIR)\str\ /c $< # ------------------------------------------------------------- # # ------------------------------------------------------------- # @@ -419,16 +435,30 @@ $(PROG3_OUTDIR): $(PROG3_DIR) $(CARES_OBJDIR): $(CARES_OUTDIR) @if not exist $(CARES_OBJDIR) mkdir $(CARES_OBJDIR) + @if not exist $(CARES_OBJDIR)\dsa mkdir $(CARES_OBJDIR)\dsa + @if not exist $(CARES_OBJDIR)\event mkdir $(CARES_OBJDIR)\event + @if not exist $(CARES_OBJDIR)\legacy mkdir $(CARES_OBJDIR)\legacy + @if not exist $(CARES_OBJDIR)\str mkdir $(CARES_OBJDIR)\str + @if not exist $(CARES_OBJDIR)\util mkdir $(CARES_OBJDIR)\util $(PROG2_OBJDIR): $(PROG2_OUTDIR) @if not exist $(PROG2_OBJDIR) mkdir $(PROG2_OBJDIR) + @if not exist $(PROG2_OBJDIR)\str mkdir $(PROG2_OBJDIR)\str $(PROG3_OBJDIR): $(PROG3_OUTDIR) @if not exist $(PROG3_OBJDIR) mkdir $(PROG3_OBJDIR) + @if not exist $(PROG3_OBJDIR)\str mkdir $(PROG3_OBJDIR)\str clean: + @-RMDIR /S /Q $(CARES_OBJDIR)\dsa >NUL 2>&1 + @-RMDIR /S /Q $(CARES_OBJDIR)\event >NUL 2>&1 + @-RMDIR /S /Q $(CARES_OBJDIR)\legacy >NUL 2>&1 + @-RMDIR /S /Q $(CARES_OBJDIR)\str >NUL 2>&1 + @-RMDIR /S /Q $(CARES_OBJDIR)\util >NUL 2>&1 @-RMDIR /S /Q $(CARES_OUTDIR) >NUL 2>&1 + @-RMDIR /S /Q $(PROG2_OBJDIR)\str >NUL 2>&1 @-RMDIR /S /Q $(PROG2_OUTDIR) >NUL 2>&1 + @-RMDIR /S /Q $(PROG3_OBJDIR)\str >NUL 2>&1 @-RMDIR /S /Q $(PROG3_OUTDIR) >NUL 2>&1 install: diff --git a/appveyor.yml b/appveyor.yml index cddcf962..63e39667 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -34,7 +34,6 @@ environment: TOOLSDIR: ./build/bin TESTDIR: ./build/bin BUILD_GOOGLETEST: yes - GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1 # MSVC 2022, 64-bit x64 (cmake) - COMPILER: MSVC @@ -47,7 +46,6 @@ environment: TESTDIR: ./build/bin CMAKE_EXTRA_OPTIONS: -GNinja -DCARES_BUILD_TESTS=ON -DGTEST_ROOT=C:\projects\googletest -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL BUILD_GOOGLETEST: yes - GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1 # MSVC 2022, 64-bit x86 (nmake) - COMPILER: MSVC @@ -57,7 +55,6 @@ environment: MSVC_SETUP_ARG: x64 MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat BUILD_GOOGLETEST: yes - GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1 # MSVC 2022, 32-bit x86 (nmake) - COMPILER: MSVC @@ -67,7 +64,6 @@ environment: MSVC_SETUP_ARG: x86 MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat BUILD_GOOGLETEST: yes - GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1 # MinGW, 32-bit x86 (makefiles) - COMPILER: MINGW @@ -76,7 +72,6 @@ environment: SKIP_TESTS: no PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH% BUILD_GOOGLETEST: yes - GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1 # MinGW, 32-bit x86 (cmake static only) - COMPILER: MINGW @@ -88,7 +83,6 @@ environment: PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH% CMAKE_EXTRA_OPTIONS: -DCARES_SHARED=OFF -GNinja -DCARES_BUILD_TESTS=ON -DGTEST_ROOT=C:\projects\googletest BUILD_GOOGLETEST: yes - GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1 # Disabled until AppVeyor updates their Visual Studio with this patch: # https://developercommunity.visualstudio.com/t/clexe-compiler-error-C1007-when-compili/10486219 diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index a1f39609..17561997 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -3,43 +3,22 @@ CSOURCES = ares__addrinfo2hostent.c \ ares__addrinfo_localhost.c \ - ares__buf.c \ ares__close_sockets.c \ ares__hosts_file.c \ - ares__htable.c \ - ares__htable_asvp.c \ - ares__htable_strvp.c \ - ares__htable_szvp.c \ - ares__htable_vpvp.c \ - ares__iface_ips.c \ - ares__llist.c \ ares__parse_into_addrinfo.c \ - ares__slist.c \ ares__socket.c \ ares__sortaddrinfo.c \ - ares__threads.c \ ares__timeval.c \ ares_android.c \ ares_cancel.c \ ares_data.c \ ares_destroy.c \ ares_dns_mapping.c \ - ares_dns_multistring.c \ + ares_dns_multistring.c \ ares_dns_name.c \ ares_dns_parse.c \ ares_dns_record.c \ ares_dns_write.c \ - ares_event_configchg.c \ - ares_event_epoll.c \ - ares_event_kqueue.c \ - ares_event_poll.c \ - ares_event_select.c \ - ares_event_thread.c \ - ares_event_wake_pipe.c \ - ares_event_win32.c \ - ares_expand_name.c \ - ares_expand_string.c \ - ares_fds.c \ ares_free_hostent.c \ ares_free_string.c \ ares_freeaddrinfo.c \ @@ -48,35 +27,17 @@ CSOURCES = ares__addrinfo2hostent.c \ ares_gethostbyaddr.c \ ares_gethostbyname.c \ ares_getnameinfo.c \ - ares_getsock.c \ ares_init.c \ ares_library_init.c \ - ares_math.c \ ares_metrics.c \ - ares_create_query.c \ ares_options.c \ - ares_parse_a_reply.c \ - ares_parse_aaaa_reply.c \ - ares_parse_caa_reply.c \ - ares_parse_mx_reply.c \ - ares_parse_naptr_reply.c \ - ares_parse_ns_reply.c \ - ares_parse_ptr_reply.c \ - ares_parse_soa_reply.c \ - ares_parse_srv_reply.c \ - ares_parse_txt_reply.c \ - ares_parse_uri_reply.c \ ares_platform.c \ ares_process.c \ ares_qcache.c \ ares_query.c \ - ares_rand.c \ ares_search.c \ ares_send.c \ - ares_strcasecmp.c \ - ares_str.c \ ares_strerror.c \ - ares_strsplit.c \ ares_sysconfig.c \ ares_sysconfig_files.c \ ares_sysconfig_mac.c \ @@ -86,32 +47,71 @@ CSOURCES = ares__addrinfo2hostent.c \ ares_version.c \ inet_net_pton.c \ inet_ntop.c \ - windows_port.c + windows_port.c \ + dsa/ares__htable.c \ + dsa/ares__htable_asvp.c \ + dsa/ares__htable_strvp.c \ + dsa/ares__htable_szvp.c \ + dsa/ares__htable_vpvp.c \ + dsa/ares__llist.c \ + dsa/ares__slist.c \ + event/ares_event_configchg.c \ + event/ares_event_epoll.c \ + event/ares_event_kqueue.c \ + event/ares_event_poll.c \ + event/ares_event_select.c \ + event/ares_event_thread.c \ + event/ares_event_wake_pipe.c \ + event/ares_event_win32.c \ + legacy/ares_create_query.c \ + legacy/ares_expand_name.c \ + legacy/ares_expand_string.c \ + legacy/ares_fds.c \ + legacy/ares_getsock.c \ + legacy/ares_parse_a_reply.c \ + legacy/ares_parse_aaaa_reply.c \ + legacy/ares_parse_caa_reply.c \ + legacy/ares_parse_mx_reply.c \ + legacy/ares_parse_naptr_reply.c \ + legacy/ares_parse_ns_reply.c \ + legacy/ares_parse_ptr_reply.c \ + legacy/ares_parse_soa_reply.c \ + legacy/ares_parse_srv_reply.c \ + legacy/ares_parse_txt_reply.c \ + legacy/ares_parse_uri_reply.c \ + str/ares__buf.c \ + str/ares_strcasecmp.c \ + str/ares_str.c \ + str/ares_strsplit.c \ + util/ares__iface_ips.c \ + util/ares__threads.c \ + util/ares_math.c \ + util/ares_rand.c -HHEADERS = ares__buf.h \ - ares__htable.h \ - ares__htable_asvp.h \ - ares__htable_strvp.h \ - ares__htable_szvp.h \ - ares__htable_vpvp.h \ - ares__iface_ips.h \ - ares__llist.h \ - ares__slist.h \ - ares__threads.h \ - ares_android.h \ +HHEADERS = ares_android.h \ ares_data.h \ ares_dns_multistring.h \ ares_dns_private.h \ - ares_event.h \ - ares_event_win32.h \ ares_getenv.h \ ares_inet_net_pton.h \ ares_ipv6.h \ ares_platform.h \ ares_private.h \ - ares_strcasecmp.h \ - ares_str.h \ - ares_strsplit.h \ ares_setup.h \ + dsa/ares__htable.h \ + dsa/ares__htable_asvp.h \ + dsa/ares__htable_strvp.h \ + dsa/ares__htable_szvp.h \ + dsa/ares__htable_vpvp.h \ + dsa/ares__llist.h \ + dsa/ares__slist.h \ + event/ares_event.h \ + event/ares_event_win32.h \ + str/ares__buf.h \ + str/ares_strcasecmp.h \ + str/ares_str.h \ + str/ares_strsplit.h \ + util/ares__iface_ips.h \ + util/ares__threads.h \ thirdparty/apple/dnsinfo.h diff --git a/src/lib/ares_destroy.c b/src/lib/ares_destroy.c index 1be42b1d..b7d36891 100644 --- a/src/lib/ares_destroy.c +++ b/src/lib/ares_destroy.c @@ -26,7 +26,7 @@ */ #include "ares_private.h" -#include "ares_event.h" +#include "event/ares_event.h" #include void ares_destroy(ares_channel_t *channel) diff --git a/src/lib/ares_init.c b/src/lib/ares_init.c index cc7b85d7..f7ef0cb7 100644 --- a/src/lib/ares_init.c +++ b/src/lib/ares_init.c @@ -63,7 +63,7 @@ #include "ares_inet_net_pton.h" #include "ares_platform.h" -#include "ares_event.h" +#include "event/ares_event.h" int ares_init(ares_channel_t **channelptr) { diff --git a/src/lib/ares_private.h b/src/lib/ares_private.h index 5506416d..3611e704 100644 --- a/src/lib/ares_private.h +++ b/src/lib/ares_private.h @@ -105,33 +105,33 @@ W32_FUNC const char *_w32_GetHostsFile(void); struct ares_rand_state; typedef struct ares_rand_state ares_rand_state; -#include "ares__llist.h" -#include "ares__slist.h" -#include "ares__htable_strvp.h" -#include "ares__htable_szvp.h" -#include "ares__htable_asvp.h" -#include "ares__htable_vpvp.h" +#include "dsa/ares__llist.h" +#include "dsa/ares__slist.h" +#include "dsa/ares__htable_strvp.h" +#include "dsa/ares__htable_szvp.h" +#include "dsa/ares__htable_asvp.h" +#include "dsa/ares__htable_vpvp.h" #include "ares_dns_multistring.h" -#include "ares__buf.h" +#include "str/ares__buf.h" #include "ares_dns_private.h" -#include "ares__iface_ips.h" -#include "ares__threads.h" +#include "util/ares__iface_ips.h" +#include "util/ares__threads.h" #ifndef HAVE_GETENV # include "ares_getenv.h" # define getenv(ptr) ares_getenv(ptr) #endif -#include "ares_str.h" -#include "ares_strsplit.h" +#include "str/ares_str.h" +#include "str/ares_strsplit.h" #ifndef HAVE_STRCASECMP -# include "ares_strcasecmp.h" +# include "str/ares_strcasecmp.h" # define strcasecmp(p1, p2) ares_strcasecmp(p1, p2) #endif #ifndef HAVE_STRNCASECMP -# include "ares_strcasecmp.h" +# include "str/ares_strcasecmp.h" # define strncasecmp(p1, p2, n) ares_strncasecmp(p1, p2, n) #endif diff --git a/src/lib/ares__htable.c b/src/lib/dsa/ares__htable.c similarity index 100% rename from src/lib/ares__htable.c rename to src/lib/dsa/ares__htable.c diff --git a/src/lib/ares__htable.h b/src/lib/dsa/ares__htable.h similarity index 100% rename from src/lib/ares__htable.h rename to src/lib/dsa/ares__htable.h diff --git a/src/lib/ares__htable_asvp.c b/src/lib/dsa/ares__htable_asvp.c similarity index 100% rename from src/lib/ares__htable_asvp.c rename to src/lib/dsa/ares__htable_asvp.c diff --git a/src/lib/ares__htable_asvp.h b/src/lib/dsa/ares__htable_asvp.h similarity index 100% rename from src/lib/ares__htable_asvp.h rename to src/lib/dsa/ares__htable_asvp.h diff --git a/src/lib/ares__htable_strvp.c b/src/lib/dsa/ares__htable_strvp.c similarity index 100% rename from src/lib/ares__htable_strvp.c rename to src/lib/dsa/ares__htable_strvp.c diff --git a/src/lib/ares__htable_strvp.h b/src/lib/dsa/ares__htable_strvp.h similarity index 100% rename from src/lib/ares__htable_strvp.h rename to src/lib/dsa/ares__htable_strvp.h diff --git a/src/lib/ares__htable_szvp.c b/src/lib/dsa/ares__htable_szvp.c similarity index 100% rename from src/lib/ares__htable_szvp.c rename to src/lib/dsa/ares__htable_szvp.c diff --git a/src/lib/ares__htable_szvp.h b/src/lib/dsa/ares__htable_szvp.h similarity index 100% rename from src/lib/ares__htable_szvp.h rename to src/lib/dsa/ares__htable_szvp.h diff --git a/src/lib/ares__htable_vpvp.c b/src/lib/dsa/ares__htable_vpvp.c similarity index 100% rename from src/lib/ares__htable_vpvp.c rename to src/lib/dsa/ares__htable_vpvp.c diff --git a/src/lib/ares__htable_vpvp.h b/src/lib/dsa/ares__htable_vpvp.h similarity index 100% rename from src/lib/ares__htable_vpvp.h rename to src/lib/dsa/ares__htable_vpvp.h diff --git a/src/lib/ares__llist.c b/src/lib/dsa/ares__llist.c similarity index 100% rename from src/lib/ares__llist.c rename to src/lib/dsa/ares__llist.c diff --git a/src/lib/ares__llist.h b/src/lib/dsa/ares__llist.h similarity index 100% rename from src/lib/ares__llist.h rename to src/lib/dsa/ares__llist.h diff --git a/src/lib/ares__slist.c b/src/lib/dsa/ares__slist.c similarity index 100% rename from src/lib/ares__slist.c rename to src/lib/dsa/ares__slist.c diff --git a/src/lib/ares__slist.h b/src/lib/dsa/ares__slist.h similarity index 100% rename from src/lib/ares__slist.h rename to src/lib/dsa/ares__slist.h diff --git a/src/lib/ares_event.h b/src/lib/event/ares_event.h similarity index 100% rename from src/lib/ares_event.h rename to src/lib/event/ares_event.h diff --git a/src/lib/ares_event_configchg.c b/src/lib/event/ares_event_configchg.c similarity index 100% rename from src/lib/ares_event_configchg.c rename to src/lib/event/ares_event_configchg.c diff --git a/src/lib/ares_event_epoll.c b/src/lib/event/ares_event_epoll.c similarity index 100% rename from src/lib/ares_event_epoll.c rename to src/lib/event/ares_event_epoll.c diff --git a/src/lib/ares_event_kqueue.c b/src/lib/event/ares_event_kqueue.c similarity index 100% rename from src/lib/ares_event_kqueue.c rename to src/lib/event/ares_event_kqueue.c diff --git a/src/lib/ares_event_poll.c b/src/lib/event/ares_event_poll.c similarity index 100% rename from src/lib/ares_event_poll.c rename to src/lib/event/ares_event_poll.c diff --git a/src/lib/ares_event_select.c b/src/lib/event/ares_event_select.c similarity index 100% rename from src/lib/ares_event_select.c rename to src/lib/event/ares_event_select.c diff --git a/src/lib/ares_event_thread.c b/src/lib/event/ares_event_thread.c similarity index 100% rename from src/lib/ares_event_thread.c rename to src/lib/event/ares_event_thread.c diff --git a/src/lib/ares_event_wake_pipe.c b/src/lib/event/ares_event_wake_pipe.c similarity index 100% rename from src/lib/ares_event_wake_pipe.c rename to src/lib/event/ares_event_wake_pipe.c diff --git a/src/lib/ares_event_win32.c b/src/lib/event/ares_event_win32.c similarity index 100% rename from src/lib/ares_event_win32.c rename to src/lib/event/ares_event_win32.c diff --git a/src/lib/ares_event_win32.h b/src/lib/event/ares_event_win32.h similarity index 100% rename from src/lib/ares_event_win32.h rename to src/lib/event/ares_event_win32.h diff --git a/src/lib/ares_create_query.c b/src/lib/legacy/ares_create_query.c similarity index 100% rename from src/lib/ares_create_query.c rename to src/lib/legacy/ares_create_query.c diff --git a/src/lib/ares_expand_name.c b/src/lib/legacy/ares_expand_name.c similarity index 100% rename from src/lib/ares_expand_name.c rename to src/lib/legacy/ares_expand_name.c diff --git a/src/lib/ares_expand_string.c b/src/lib/legacy/ares_expand_string.c similarity index 100% rename from src/lib/ares_expand_string.c rename to src/lib/legacy/ares_expand_string.c diff --git a/src/lib/ares_fds.c b/src/lib/legacy/ares_fds.c similarity index 100% rename from src/lib/ares_fds.c rename to src/lib/legacy/ares_fds.c diff --git a/src/lib/ares_getsock.c b/src/lib/legacy/ares_getsock.c similarity index 100% rename from src/lib/ares_getsock.c rename to src/lib/legacy/ares_getsock.c diff --git a/src/lib/ares_parse_a_reply.c b/src/lib/legacy/ares_parse_a_reply.c similarity index 100% rename from src/lib/ares_parse_a_reply.c rename to src/lib/legacy/ares_parse_a_reply.c diff --git a/src/lib/ares_parse_aaaa_reply.c b/src/lib/legacy/ares_parse_aaaa_reply.c similarity index 100% rename from src/lib/ares_parse_aaaa_reply.c rename to src/lib/legacy/ares_parse_aaaa_reply.c diff --git a/src/lib/ares_parse_caa_reply.c b/src/lib/legacy/ares_parse_caa_reply.c similarity index 100% rename from src/lib/ares_parse_caa_reply.c rename to src/lib/legacy/ares_parse_caa_reply.c diff --git a/src/lib/ares_parse_mx_reply.c b/src/lib/legacy/ares_parse_mx_reply.c similarity index 100% rename from src/lib/ares_parse_mx_reply.c rename to src/lib/legacy/ares_parse_mx_reply.c diff --git a/src/lib/ares_parse_naptr_reply.c b/src/lib/legacy/ares_parse_naptr_reply.c similarity index 100% rename from src/lib/ares_parse_naptr_reply.c rename to src/lib/legacy/ares_parse_naptr_reply.c diff --git a/src/lib/ares_parse_ns_reply.c b/src/lib/legacy/ares_parse_ns_reply.c similarity index 100% rename from src/lib/ares_parse_ns_reply.c rename to src/lib/legacy/ares_parse_ns_reply.c diff --git a/src/lib/ares_parse_ptr_reply.c b/src/lib/legacy/ares_parse_ptr_reply.c similarity index 100% rename from src/lib/ares_parse_ptr_reply.c rename to src/lib/legacy/ares_parse_ptr_reply.c diff --git a/src/lib/ares_parse_soa_reply.c b/src/lib/legacy/ares_parse_soa_reply.c similarity index 100% rename from src/lib/ares_parse_soa_reply.c rename to src/lib/legacy/ares_parse_soa_reply.c diff --git a/src/lib/ares_parse_srv_reply.c b/src/lib/legacy/ares_parse_srv_reply.c similarity index 100% rename from src/lib/ares_parse_srv_reply.c rename to src/lib/legacy/ares_parse_srv_reply.c diff --git a/src/lib/ares_parse_txt_reply.c b/src/lib/legacy/ares_parse_txt_reply.c similarity index 100% rename from src/lib/ares_parse_txt_reply.c rename to src/lib/legacy/ares_parse_txt_reply.c diff --git a/src/lib/ares_parse_uri_reply.c b/src/lib/legacy/ares_parse_uri_reply.c similarity index 100% rename from src/lib/ares_parse_uri_reply.c rename to src/lib/legacy/ares_parse_uri_reply.c diff --git a/src/lib/ares__buf.c b/src/lib/str/ares__buf.c similarity index 100% rename from src/lib/ares__buf.c rename to src/lib/str/ares__buf.c diff --git a/src/lib/ares__buf.h b/src/lib/str/ares__buf.h similarity index 100% rename from src/lib/ares__buf.h rename to src/lib/str/ares__buf.h diff --git a/src/lib/ares_str.c b/src/lib/str/ares_str.c similarity index 100% rename from src/lib/ares_str.c rename to src/lib/str/ares_str.c diff --git a/src/lib/ares_str.h b/src/lib/str/ares_str.h similarity index 100% rename from src/lib/ares_str.h rename to src/lib/str/ares_str.h diff --git a/src/lib/ares_strcasecmp.c b/src/lib/str/ares_strcasecmp.c similarity index 100% rename from src/lib/ares_strcasecmp.c rename to src/lib/str/ares_strcasecmp.c diff --git a/src/lib/ares_strcasecmp.h b/src/lib/str/ares_strcasecmp.h similarity index 100% rename from src/lib/ares_strcasecmp.h rename to src/lib/str/ares_strcasecmp.h diff --git a/src/lib/ares_strsplit.c b/src/lib/str/ares_strsplit.c similarity index 100% rename from src/lib/ares_strsplit.c rename to src/lib/str/ares_strsplit.c diff --git a/src/lib/ares_strsplit.h b/src/lib/str/ares_strsplit.h similarity index 100% rename from src/lib/ares_strsplit.h rename to src/lib/str/ares_strsplit.h diff --git a/src/lib/ares__iface_ips.c b/src/lib/util/ares__iface_ips.c similarity index 100% rename from src/lib/ares__iface_ips.c rename to src/lib/util/ares__iface_ips.c diff --git a/src/lib/ares__iface_ips.h b/src/lib/util/ares__iface_ips.h similarity index 100% rename from src/lib/ares__iface_ips.h rename to src/lib/util/ares__iface_ips.h diff --git a/src/lib/ares__threads.c b/src/lib/util/ares__threads.c similarity index 100% rename from src/lib/ares__threads.c rename to src/lib/util/ares__threads.c diff --git a/src/lib/ares__threads.h b/src/lib/util/ares__threads.h similarity index 100% rename from src/lib/ares__threads.h rename to src/lib/util/ares__threads.h diff --git a/src/lib/ares_math.c b/src/lib/util/ares_math.c similarity index 100% rename from src/lib/ares_math.c rename to src/lib/util/ares_math.c diff --git a/src/lib/ares_rand.c b/src/lib/util/ares_rand.c similarity index 100% rename from src/lib/ares_rand.c rename to src/lib/util/ares_rand.c diff --git a/src/tools/Makefile.inc b/src/tools/Makefile.inc index dd081b30..4c6b6aaa 100644 --- a/src/tools/Makefile.inc +++ b/src/tools/Makefile.inc @@ -1,7 +1,7 @@ # Copyright (C) The c-ares project and its contributors # SPDX-License-Identifier: MIT SAMPLESOURCES = ares_getopt.c \ - ../lib/ares_strcasecmp.c + ../lib/str/ares_strcasecmp.c SAMPLEHEADERS = ares_getopt.h \ - ../lib/ares_strcasecmp.h + ../lib/str/ares_strcasecmp.h diff --git a/src/tools/adig.c b/src/tools/adig.c index d0acb02e..f3d1a392 100644 --- a/src/tools/adig.c +++ b/src/tools/adig.c @@ -46,17 +46,17 @@ #include "ares_dns.h" #ifndef HAVE_STRDUP -# include "ares_str.h" +# include "str/ares_str.h" # define strdup(ptr) ares_strdup(ptr) #endif #ifndef HAVE_STRCASECMP -# include "ares_strcasecmp.h" +# include "str/ares_strcasecmp.h" # define strcasecmp(p1, p2) ares_strcasecmp(p1, p2) #endif #ifndef HAVE_STRNCASECMP -# include "ares_strcasecmp.h" +# include "str/ares_strcasecmp.h" # define strncasecmp(p1, p2, n) ares_strncasecmp(p1, p2, n) #endif diff --git a/src/tools/ahost.c b/src/tools/ahost.c index 10ce14d4..73f29002 100644 --- a/src/tools/ahost.c +++ b/src/tools/ahost.c @@ -43,17 +43,17 @@ #include "ares_ipv6.h" #ifndef HAVE_STRDUP -# include "ares_str.h" +# include "str/ares_str.h" # define strdup(ptr) ares_strdup(ptr) #endif #ifndef HAVE_STRCASECMP -# include "ares_strcasecmp.h" +# include "str/ares_strcasecmp.h" # define strcasecmp(p1, p2) ares_strcasecmp(p1, p2) #endif #ifndef HAVE_STRNCASECMP -# include "ares_strcasecmp.h" +# include "str/ares_strcasecmp.h" # define strncasecmp(p1, p2, n) ares_strncasecmp(p1, p2, n) #endif diff --git a/test/ares-test-internal.cc b/test/ares-test-internal.cc index f4f84ad0..3d6e1d8f 100644 --- a/test/ares-test-internal.cc +++ b/test/ares-test-internal.cc @@ -45,8 +45,8 @@ extern "C" { #include "ares_private.h" #include "ares_inet_net_pton.h" #include "ares_data.h" -#include "ares_strsplit.h" -#include "ares__htable.h" +#include "str/ares_strsplit.h" +#include "dsa/ares__htable.h" #ifdef HAVE_ARPA_INET_H #include diff --git a/test/ares-test.cc b/test/ares-test.cc index a6f1af12..5cd4a18b 100644 --- a/test/ares-test.cc +++ b/test/ares-test.cc @@ -41,7 +41,7 @@ extern "C" { #include "ares_setup.h" #include "ares_inet_net_pton.h" #include "ares_data.h" -#include "ares_strsplit.h" +#include "str/ares_strsplit.h" #include "ares_private.h" }