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)
pull/824/head
Brad House 4 months ago committed by GitHub
parent 58ae7e809a
commit 130fd4794b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      .cirrus.yml
  2. 38
      .github/workflows/coveralls.yml
  3. 24
      CMakeLists.txt
  4. 60
      Makefile.Watcom
  5. 29
      Makefile.dj
  6. 44
      Makefile.msvc
  7. 6
      appveyor.yml
  8. 112
      src/lib/Makefile.inc
  9. 2
      src/lib/ares_destroy.c
  10. 2
      src/lib/ares_init.c
  11. 26
      src/lib/ares_private.h
  12. 0
      src/lib/dsa/ares__htable.c
  13. 0
      src/lib/dsa/ares__htable.h
  14. 0
      src/lib/dsa/ares__htable_asvp.c
  15. 0
      src/lib/dsa/ares__htable_asvp.h
  16. 0
      src/lib/dsa/ares__htable_strvp.c
  17. 0
      src/lib/dsa/ares__htable_strvp.h
  18. 0
      src/lib/dsa/ares__htable_szvp.c
  19. 0
      src/lib/dsa/ares__htable_szvp.h
  20. 0
      src/lib/dsa/ares__htable_vpvp.c
  21. 0
      src/lib/dsa/ares__htable_vpvp.h
  22. 0
      src/lib/dsa/ares__llist.c
  23. 0
      src/lib/dsa/ares__llist.h
  24. 0
      src/lib/dsa/ares__slist.c
  25. 0
      src/lib/dsa/ares__slist.h
  26. 0
      src/lib/event/ares_event.h
  27. 0
      src/lib/event/ares_event_configchg.c
  28. 0
      src/lib/event/ares_event_epoll.c
  29. 0
      src/lib/event/ares_event_kqueue.c
  30. 0
      src/lib/event/ares_event_poll.c
  31. 0
      src/lib/event/ares_event_select.c
  32. 0
      src/lib/event/ares_event_thread.c
  33. 0
      src/lib/event/ares_event_wake_pipe.c
  34. 0
      src/lib/event/ares_event_win32.c
  35. 0
      src/lib/event/ares_event_win32.h
  36. 0
      src/lib/legacy/ares_create_query.c
  37. 0
      src/lib/legacy/ares_expand_name.c
  38. 0
      src/lib/legacy/ares_expand_string.c
  39. 0
      src/lib/legacy/ares_fds.c
  40. 0
      src/lib/legacy/ares_getsock.c
  41. 0
      src/lib/legacy/ares_parse_a_reply.c
  42. 0
      src/lib/legacy/ares_parse_aaaa_reply.c
  43. 0
      src/lib/legacy/ares_parse_caa_reply.c
  44. 0
      src/lib/legacy/ares_parse_mx_reply.c
  45. 0
      src/lib/legacy/ares_parse_naptr_reply.c
  46. 0
      src/lib/legacy/ares_parse_ns_reply.c
  47. 0
      src/lib/legacy/ares_parse_ptr_reply.c
  48. 0
      src/lib/legacy/ares_parse_soa_reply.c
  49. 0
      src/lib/legacy/ares_parse_srv_reply.c
  50. 0
      src/lib/legacy/ares_parse_txt_reply.c
  51. 0
      src/lib/legacy/ares_parse_uri_reply.c
  52. 0
      src/lib/str/ares__buf.c
  53. 0
      src/lib/str/ares__buf.h
  54. 0
      src/lib/str/ares_str.c
  55. 0
      src/lib/str/ares_str.h
  56. 0
      src/lib/str/ares_strcasecmp.c
  57. 0
      src/lib/str/ares_strcasecmp.h
  58. 0
      src/lib/str/ares_strsplit.c
  59. 0
      src/lib/str/ares_strsplit.h
  60. 0
      src/lib/util/ares__iface_ips.c
  61. 0
      src/lib/util/ares__iface_ips.h
  62. 0
      src/lib/util/ares__threads.c
  63. 0
      src/lib/util/ares__threads.h
  64. 0
      src/lib/util/ares_math.c
  65. 0
      src/lib/util/ares_rand.c
  66. 4
      src/tools/Makefile.inc
  67. 6
      src/tools/adig.c
  68. 6
      src/tools/ahost.c
  69. 4
      test/ares-test-internal.cc
  70. 2
      test/ares-test.cc

@ -7,6 +7,7 @@ env:
CMAKE_TEST_FLAGS: "-DCARES_BUILD_TESTS=ON" CMAKE_TEST_FLAGS: "-DCARES_BUILD_TESTS=ON"
task: task:
skip: "changesIncludeOnly('doc/*', '.github/*', 'appveyor.yml', '*.md', 'Makefile.watcom', 'Makefile.dj', 'Makefile.msvc', 'Makefile.m32')"
matrix: matrix:
- name: "Debian amd64" - name: "Debian amd64"
env: env:
@ -151,17 +152,17 @@ task:
BUILD_TYPE: "valgrind" BUILD_TYPE: "valgrind"
TEST_WRAP: "valgrind --leak-check=full" TEST_WRAP: "valgrind --leak-check=full"
TEST_FILTER: "--gtest_filter=-*Container*:-*LiveSearchANY*" TEST_FILTER: "--gtest_filter=-*Container*:-*LiveSearchANY*"
- name: "COVERAGE" # - name: "COVERAGE"
only_if: $BUILD_COVERAGE == 'yes' # only_if: $BUILD_COVERAGE == 'yes'
env: # env:
BUILD_TYPE: "coverage" # BUILD_TYPE: "coverage"
CI_NAME: "cirrus-ci" # CI_NAME: "cirrus-ci"
CI_BUILD_NUMBER: "${CIRRUS_TASK_ID}" # CI_BUILD_NUMBER: "${CIRRUS_TASK_ID}"
CI_BUILD_URL: "https://cirrus-ci.com/task/${CIRRUS_TASK_ID}" # CI_BUILD_URL: "https://cirrus-ci.com/task/${CIRRUS_TASK_ID}"
CI_BRANCH: "${CIRRUS_BRANCH}" # CI_BRANCH: "${CIRRUS_BRANCH}"
CI_PULL_REQUEST: "${CIRRUS_PR}" # CI_PULL_REQUEST: "${CIRRUS_PR}"
COVERALLS_REPO_TOKEN: "ENCRYPTED[a46bc6ca908e9e74f102c686cde67cae21d3e792dff46a60e860d1179d9349e8eb5a529132d0effefebdb0dbc3f95810]" # COVERALLS_REPO_TOKEN: "ENCRYPTED[a46bc6ca908e9e74f102c686cde67cae21d3e792dff46a60e860d1179d9349e8eb5a529132d0effefebdb0dbc3f95810]"
CONFIG_OPTS: "--enable-debug --disable-shared --enable-code-coverage --enable-tests" # CONFIG_OPTS: "--enable-debug --disable-shared --enable-code-coverage --enable-tests"
install_script: install_script:
- | - |

@ -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 }}

@ -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_BUILD_TOOLS "Build tools" ON)
OPTION (CARES_SYMBOL_HIDING "Hide private symbols in shared libraries" OFF) OPTION (CARES_SYMBOL_HIDING "Hide private symbols in shared libraries" OFF)
OPTION (CARES_THREADS "Build with thread-safety support" ON) 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") 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) SET (CARES_HAVE_ARPA_NAMESER_COMPAT_H 1)
ENDIF() 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 # TRANSFORM_MAKEFILE_INC
# #
# This function consumes the "Makefile.inc" autotools file, and converts it into # 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 () ENDIF ()
# Export targets # Export targets
IF (CARES_INSTALL) IF (CARES_INSTALL)
SET (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") SET (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")

@ -97,7 +97,17 @@ all: $(ARESBUILDH) $(OBJ_BASE) $(TARGETS) $(DEMOS) .SYMBOLIC
$(OBJ_BASE): $(OBJ_BASE):
-$(MD) $^@ -$(MD) $^@
-$(MD) $^@\stat -$(MD) $^@\stat
-$(MD) $^@\stat\dsa
-$(MD) $^@\stat\event
-$(MD) $^@\stat\legacy
-$(MD) $^@\stat\str
-$(MD) $^@\stat\util
-$(MD) $^@\dyn -$(MD) $^@\dyn
-$(MD) $^@\dyn\dsa
-$(MD) $^@\dyn\event
-$(MD) $^@\dyn\legacy
-$(MD) $^@\dyn\str
-$(MD) $^@\dyn\util
-$(MD) $^@\tools -$(MD) $^@\tools
$(ARESBUILDH): .EXISTSONLY $(ARESBUILDH): .EXISTSONLY
@ -129,7 +139,17 @@ vclean realclean: clean .SYMBOLIC
-$(RM) $(TARGETS) $(LIBNAME).map -$(RM) $(TARGETS) $(LIBNAME).map
-$(RM) $(DEMOS) $(DEMOS:.exe=.map) -$(RM) $(DEMOS) $(DEMOS:.exe=.map)
-$(RD) $(OBJ_BASE)\stat -$(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
-$(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)\tools
-$(RD) $(OBJ_BASE) -$(RD) $(OBJ_BASE)
@ -144,10 +164,50 @@ $(RESOURCE): src\lib\cares.rc .AUTODEPEND
.c{$(OBJ_BASE)\dyn}.obj: .c{$(OBJ_BASE)\dyn}.obj:
$(CC) $(CFLAGS) -bd .\src\lib\$^& -fo=$^@ $(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 .ERASE
.c{$(OBJ_BASE)\stat}.obj: .c{$(OBJ_BASE)\stat}.obj:
$(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\$^& -fo=$^@ $(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__) $(LINK_ARG): $(__MAKEFILES__)
%create $^@ %create $^@
@%append $^@ system nt dll @%append $^@ system nt dll

@ -5,8 +5,14 @@
# #
include src/lib/Makefile.inc include src/lib/Makefile.inc
CSOURCES := $(addprefix src/lib/, $(CSOURCES)) OBJ_DIR = djgpp
CSOURCES := $(filter-out src/lib/windows_port.c, $(CSOURCES)) 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 VPATH = src/lib src/tools
@ -17,8 +23,6 @@ VPATH = src/lib src/tools
WATT32_ROOT = $(realpath $(WATT_ROOT)) WATT32_ROOT = $(realpath $(WATT_ROOT))
WATT32_LIB = $(WATT32_ROOT)/lib/libwatt.a WATT32_LIB = $(WATT32_ROOT)/lib/libwatt.a
OBJ_DIR = djgpp
CFLAGS = -g -O2 -I./include -I./src/lib \ CFLAGS = -g -O2 -I./include -I./src/lib \
-I$(WATT32_ROOT)/inc \ -I$(WATT32_ROOT)/inc \
-Wall \ -Wall \
@ -82,9 +86,6 @@ else
CC = gcc CC = gcc
endif endif
OBJECTS = $(addprefix $(OBJ_DIR)/, \
$(notdir $(CSOURCES:.c=.o)))
GENERATED = src/lib/ares_config.h \ GENERATED = src/lib/ares_config.h \
include/ares_build.h include/ares_build.h
@ -92,7 +93,7 @@ TARGETS = libcares.a adig.exe ahost.exe
.SECONDARY: $(OBJ_DIR)/ares_getopt.o .SECONDARY: $(OBJ_DIR)/ares_getopt.o
all: $(OBJ_DIR) $(GENERATED) $(TARGETS) all: $(OBJ_DIR) $(OBJ_SUBDIRS) $(GENERATED) $(TARGETS)
@echo Welcome to c-ares. @echo Welcome to c-ares.
libcares.a: $(OBJECTS) libcares.a: $(OBJECTS)
@ -111,15 +112,19 @@ include/ares_build.h: include/ares_build.h.dist
# #
clean: clean:
- rm -f depend.dj $(GENERATED) $(OBJ_DIR)/*.o - rm -f depend.dj $(GENERATED) $(OBJ_DIR)/*.o
- rmdir $(OBJ_DIR) - rmdir $(OBJ_SUBDIRS)
# Clean everything # Clean everything
# #
realclean vclean: clean realclean vclean: clean
- rm -f $(TARGETS) $(TARGETS:.exe=.map) - rm -f $(TARGETS) $(TARGETS:.exe=.map)
$(OBJ_DIR): .PHONY: obj_subdirs $(OBJ_SUBDIRS)
- mkdir $@
obj_subdirs: $(OBJ_SUBDIRS)
$(OBJ_SUBDIRS):
mkdir $@
$(OBJ_DIR)/%.o: %.c $(OBJ_DIR)/%.o: %.c
$(CC) $(CFLAGS) -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. # a foreign 'curl_config.h' is making trouble.
# #
depend: $(GENERATED) Makefile.dj depend: $(GENERATED) Makefile.dj
$(CC) -MM $(CFLAGS) $(CSOURCES) | $(DEP_REPLACE) > depend.dj $(CC) -MM $(CFLAGS) $(CSRC) | $(DEP_REPLACE) > depend.dj
-include depend.dj -include depend.dj

@ -299,6 +299,7 @@ RC_CMD = $(RC_CMD_DBG)
!ERROR Problem generating CARES_OBJS list. !ERROR Problem generating CARES_OBJS list.
!ENDIF !ENDIF
CARES_OBJS = $(CARES_OBJS:.c=.obj) CARES_OBJS = $(CARES_OBJS:.c=.obj)
CARES_OBJS = $(CARES_OBJS:/=\)
!IF "$(USE_RES_FILE)" == "TRUE" !IF "$(USE_RES_FILE)" == "TRUE"
CARES_OBJS = $(CARES_OBJS) $(CARES_OBJDIR)\cares.res CARES_OBJS = $(CARES_OBJS) $(CARES_OBJDIR)\cares.res
!ENDIF !ENDIF
@ -341,20 +342,35 @@ PROG3_OBJS = $(PROG3_OBJS) $(PROG3_OBJDIR)\ahost.obj
{$(SRCDIR)\src\lib}.c{$(CARES_OBJDIR)}.obj: {$(SRCDIR)\src\lib}.c{$(CARES_OBJDIR)}.obj:
$(CC_CMD) $(CC_CFLAGS) $(CARES_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< $(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: {$(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: {$(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. # share some files with the library itself. We need to hack around that here.
{$(SRCDIR)\src\lib}.c{$(PROG2_OBJDIR)\..\lib}.obj: {$(SRCDIR)\src\lib\str}.c{$(PROG2_OBJDIR)\..\lib\str}.obj:
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG2_OBJDIR)\$(@F) /Fd$(PROG2_OBJDIR)\ /c $< $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG2_OBJDIR)\str\$(@F) /Fd$(PROG2_OBJDIR)\str\ /c $<
{$(SRCDIR)\src\lib}.c{$(PROG3_OBJDIR)\..\lib}.obj: {$(SRCDIR)\src\lib\str}.c{$(PROG3_OBJDIR)\..\lib\str}.obj:
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG3_OBJDIR)\$(@F) /Fd$(PROG3_OBJDIR)\ /c $< $(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) $(CARES_OBJDIR): $(CARES_OUTDIR)
@if not exist $(CARES_OBJDIR) mkdir $(CARES_OBJDIR) @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) $(PROG2_OBJDIR): $(PROG2_OUTDIR)
@if not exist $(PROG2_OBJDIR) mkdir $(PROG2_OBJDIR) @if not exist $(PROG2_OBJDIR) mkdir $(PROG2_OBJDIR)
@if not exist $(PROG2_OBJDIR)\str mkdir $(PROG2_OBJDIR)\str
$(PROG3_OBJDIR): $(PROG3_OUTDIR) $(PROG3_OBJDIR): $(PROG3_OUTDIR)
@if not exist $(PROG3_OBJDIR) mkdir $(PROG3_OBJDIR) @if not exist $(PROG3_OBJDIR) mkdir $(PROG3_OBJDIR)
@if not exist $(PROG3_OBJDIR)\str mkdir $(PROG3_OBJDIR)\str
clean: 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 $(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 $(PROG2_OUTDIR) >NUL 2>&1
@-RMDIR /S /Q $(PROG3_OBJDIR)\str >NUL 2>&1
@-RMDIR /S /Q $(PROG3_OUTDIR) >NUL 2>&1 @-RMDIR /S /Q $(PROG3_OUTDIR) >NUL 2>&1
install: install:

@ -34,7 +34,6 @@ environment:
TOOLSDIR: ./build/bin TOOLSDIR: ./build/bin
TESTDIR: ./build/bin TESTDIR: ./build/bin
BUILD_GOOGLETEST: yes BUILD_GOOGLETEST: yes
GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1
# MSVC 2022, 64-bit x64 (cmake) # MSVC 2022, 64-bit x64 (cmake)
- COMPILER: MSVC - COMPILER: MSVC
@ -47,7 +46,6 @@ environment:
TESTDIR: ./build/bin TESTDIR: ./build/bin
CMAKE_EXTRA_OPTIONS: -GNinja -DCARES_BUILD_TESTS=ON -DGTEST_ROOT=C:\projects\googletest -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL CMAKE_EXTRA_OPTIONS: -GNinja -DCARES_BUILD_TESTS=ON -DGTEST_ROOT=C:\projects\googletest -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL
BUILD_GOOGLETEST: yes BUILD_GOOGLETEST: yes
GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1
# MSVC 2022, 64-bit x86 (nmake) # MSVC 2022, 64-bit x86 (nmake)
- COMPILER: MSVC - COMPILER: MSVC
@ -57,7 +55,6 @@ environment:
MSVC_SETUP_ARG: x64 MSVC_SETUP_ARG: x64
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat
BUILD_GOOGLETEST: yes BUILD_GOOGLETEST: yes
GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1
# MSVC 2022, 32-bit x86 (nmake) # MSVC 2022, 32-bit x86 (nmake)
- COMPILER: MSVC - COMPILER: MSVC
@ -67,7 +64,6 @@ environment:
MSVC_SETUP_ARG: x86 MSVC_SETUP_ARG: x86
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat
BUILD_GOOGLETEST: yes BUILD_GOOGLETEST: yes
GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1
# MinGW, 32-bit x86 (makefiles) # MinGW, 32-bit x86 (makefiles)
- COMPILER: MINGW - COMPILER: MINGW
@ -76,7 +72,6 @@ environment:
SKIP_TESTS: no SKIP_TESTS: no
PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH% PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH%
BUILD_GOOGLETEST: yes BUILD_GOOGLETEST: yes
GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1
# MinGW, 32-bit x86 (cmake static only) # MinGW, 32-bit x86 (cmake static only)
- COMPILER: MINGW - COMPILER: MINGW
@ -88,7 +83,6 @@ environment:
PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH% 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 CMAKE_EXTRA_OPTIONS: -DCARES_SHARED=OFF -GNinja -DCARES_BUILD_TESTS=ON -DGTEST_ROOT=C:\projects\googletest
BUILD_GOOGLETEST: yes BUILD_GOOGLETEST: yes
GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1
# Disabled until AppVeyor updates their Visual Studio with this patch: # Disabled until AppVeyor updates their Visual Studio with this patch:
# https://developercommunity.visualstudio.com/t/clexe-compiler-error-C1007-when-compili/10486219 # https://developercommunity.visualstudio.com/t/clexe-compiler-error-C1007-when-compili/10486219

@ -3,21 +3,11 @@
CSOURCES = ares__addrinfo2hostent.c \ CSOURCES = ares__addrinfo2hostent.c \
ares__addrinfo_localhost.c \ ares__addrinfo_localhost.c \
ares__buf.c \
ares__close_sockets.c \ ares__close_sockets.c \
ares__hosts_file.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__parse_into_addrinfo.c \
ares__slist.c \
ares__socket.c \ ares__socket.c \
ares__sortaddrinfo.c \ ares__sortaddrinfo.c \
ares__threads.c \
ares__timeval.c \ ares__timeval.c \
ares_android.c \ ares_android.c \
ares_cancel.c \ ares_cancel.c \
@ -29,17 +19,6 @@ CSOURCES = ares__addrinfo2hostent.c \
ares_dns_parse.c \ ares_dns_parse.c \
ares_dns_record.c \ ares_dns_record.c \
ares_dns_write.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_hostent.c \
ares_free_string.c \ ares_free_string.c \
ares_freeaddrinfo.c \ ares_freeaddrinfo.c \
@ -48,35 +27,17 @@ CSOURCES = ares__addrinfo2hostent.c \
ares_gethostbyaddr.c \ ares_gethostbyaddr.c \
ares_gethostbyname.c \ ares_gethostbyname.c \
ares_getnameinfo.c \ ares_getnameinfo.c \
ares_getsock.c \
ares_init.c \ ares_init.c \
ares_library_init.c \ ares_library_init.c \
ares_math.c \
ares_metrics.c \ ares_metrics.c \
ares_create_query.c \
ares_options.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_platform.c \
ares_process.c \ ares_process.c \
ares_qcache.c \ ares_qcache.c \
ares_query.c \ ares_query.c \
ares_rand.c \
ares_search.c \ ares_search.c \
ares_send.c \ ares_send.c \
ares_strcasecmp.c \
ares_str.c \
ares_strerror.c \ ares_strerror.c \
ares_strsplit.c \
ares_sysconfig.c \ ares_sysconfig.c \
ares_sysconfig_files.c \ ares_sysconfig_files.c \
ares_sysconfig_mac.c \ ares_sysconfig_mac.c \
@ -86,32 +47,71 @@ CSOURCES = ares__addrinfo2hostent.c \
ares_version.c \ ares_version.c \
inet_net_pton.c \ inet_net_pton.c \
inet_ntop.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 \ HHEADERS = ares_android.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 \
ares_data.h \ ares_data.h \
ares_dns_multistring.h \ ares_dns_multistring.h \
ares_dns_private.h \ ares_dns_private.h \
ares_event.h \
ares_event_win32.h \
ares_getenv.h \ ares_getenv.h \
ares_inet_net_pton.h \ ares_inet_net_pton.h \
ares_ipv6.h \ ares_ipv6.h \
ares_platform.h \ ares_platform.h \
ares_private.h \ ares_private.h \
ares_strcasecmp.h \
ares_str.h \
ares_strsplit.h \
ares_setup.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 thirdparty/apple/dnsinfo.h

@ -26,7 +26,7 @@
*/ */
#include "ares_private.h" #include "ares_private.h"
#include "ares_event.h" #include "event/ares_event.h"
#include <assert.h> #include <assert.h>
void ares_destroy(ares_channel_t *channel) void ares_destroy(ares_channel_t *channel)

@ -63,7 +63,7 @@
#include "ares_inet_net_pton.h" #include "ares_inet_net_pton.h"
#include "ares_platform.h" #include "ares_platform.h"
#include "ares_event.h" #include "event/ares_event.h"
int ares_init(ares_channel_t **channelptr) int ares_init(ares_channel_t **channelptr)
{ {

@ -105,33 +105,33 @@ W32_FUNC const char *_w32_GetHostsFile(void);
struct ares_rand_state; struct ares_rand_state;
typedef struct ares_rand_state ares_rand_state; typedef struct ares_rand_state ares_rand_state;
#include "ares__llist.h" #include "dsa/ares__llist.h"
#include "ares__slist.h" #include "dsa/ares__slist.h"
#include "ares__htable_strvp.h" #include "dsa/ares__htable_strvp.h"
#include "ares__htable_szvp.h" #include "dsa/ares__htable_szvp.h"
#include "ares__htable_asvp.h" #include "dsa/ares__htable_asvp.h"
#include "ares__htable_vpvp.h" #include "dsa/ares__htable_vpvp.h"
#include "ares_dns_multistring.h" #include "ares_dns_multistring.h"
#include "ares__buf.h" #include "str/ares__buf.h"
#include "ares_dns_private.h" #include "ares_dns_private.h"
#include "ares__iface_ips.h" #include "util/ares__iface_ips.h"
#include "ares__threads.h" #include "util/ares__threads.h"
#ifndef HAVE_GETENV #ifndef HAVE_GETENV
# include "ares_getenv.h" # include "ares_getenv.h"
# define getenv(ptr) ares_getenv(ptr) # define getenv(ptr) ares_getenv(ptr)
#endif #endif
#include "ares_str.h" #include "str/ares_str.h"
#include "ares_strsplit.h" #include "str/ares_strsplit.h"
#ifndef HAVE_STRCASECMP #ifndef HAVE_STRCASECMP
# include "ares_strcasecmp.h" # include "str/ares_strcasecmp.h"
# define strcasecmp(p1, p2) ares_strcasecmp(p1, p2) # define strcasecmp(p1, p2) ares_strcasecmp(p1, p2)
#endif #endif
#ifndef HAVE_STRNCASECMP #ifndef HAVE_STRNCASECMP
# include "ares_strcasecmp.h" # include "str/ares_strcasecmp.h"
# define strncasecmp(p1, p2, n) ares_strncasecmp(p1, p2, n) # define strncasecmp(p1, p2, n) ares_strncasecmp(p1, p2, n)
#endif #endif

@ -1,7 +1,7 @@
# Copyright (C) The c-ares project and its contributors # Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
SAMPLESOURCES = ares_getopt.c \ SAMPLESOURCES = ares_getopt.c \
../lib/ares_strcasecmp.c ../lib/str/ares_strcasecmp.c
SAMPLEHEADERS = ares_getopt.h \ SAMPLEHEADERS = ares_getopt.h \
../lib/ares_strcasecmp.h ../lib/str/ares_strcasecmp.h

@ -46,17 +46,17 @@
#include "ares_dns.h" #include "ares_dns.h"
#ifndef HAVE_STRDUP #ifndef HAVE_STRDUP
# include "ares_str.h" # include "str/ares_str.h"
# define strdup(ptr) ares_strdup(ptr) # define strdup(ptr) ares_strdup(ptr)
#endif #endif
#ifndef HAVE_STRCASECMP #ifndef HAVE_STRCASECMP
# include "ares_strcasecmp.h" # include "str/ares_strcasecmp.h"
# define strcasecmp(p1, p2) ares_strcasecmp(p1, p2) # define strcasecmp(p1, p2) ares_strcasecmp(p1, p2)
#endif #endif
#ifndef HAVE_STRNCASECMP #ifndef HAVE_STRNCASECMP
# include "ares_strcasecmp.h" # include "str/ares_strcasecmp.h"
# define strncasecmp(p1, p2, n) ares_strncasecmp(p1, p2, n) # define strncasecmp(p1, p2, n) ares_strncasecmp(p1, p2, n)
#endif #endif

@ -43,17 +43,17 @@
#include "ares_ipv6.h" #include "ares_ipv6.h"
#ifndef HAVE_STRDUP #ifndef HAVE_STRDUP
# include "ares_str.h" # include "str/ares_str.h"
# define strdup(ptr) ares_strdup(ptr) # define strdup(ptr) ares_strdup(ptr)
#endif #endif
#ifndef HAVE_STRCASECMP #ifndef HAVE_STRCASECMP
# include "ares_strcasecmp.h" # include "str/ares_strcasecmp.h"
# define strcasecmp(p1, p2) ares_strcasecmp(p1, p2) # define strcasecmp(p1, p2) ares_strcasecmp(p1, p2)
#endif #endif
#ifndef HAVE_STRNCASECMP #ifndef HAVE_STRNCASECMP
# include "ares_strcasecmp.h" # include "str/ares_strcasecmp.h"
# define strncasecmp(p1, p2, n) ares_strncasecmp(p1, p2, n) # define strncasecmp(p1, p2, n) ares_strncasecmp(p1, p2, n)
#endif #endif

@ -45,8 +45,8 @@ extern "C" {
#include "ares_private.h" #include "ares_private.h"
#include "ares_inet_net_pton.h" #include "ares_inet_net_pton.h"
#include "ares_data.h" #include "ares_data.h"
#include "ares_strsplit.h" #include "str/ares_strsplit.h"
#include "ares__htable.h" #include "dsa/ares__htable.h"
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>

2
test/ares-test.cc vendored

@ -41,7 +41,7 @@ extern "C" {
#include "ares_setup.h" #include "ares_setup.h"
#include "ares_inet_net_pton.h" #include "ares_inet_net_pton.h"
#include "ares_data.h" #include "ares_data.h"
#include "ares_strsplit.h" #include "str/ares_strsplit.h"
#include "ares_private.h" #include "ares_private.h"
} }

Loading…
Cancel
Save