Skip to content

Commit

Permalink
repo structure: move headers to new include/microdns folder
Browse files Browse the repository at this point in the history
With that change, libmicrodns can be used as a meson subproject
without requiring the parent project to use a different include
path.

This also makes the examples more readily copypastable, as the
include is switched from `#include "microdns.h"` to
`#include <microdns/microdns.h`, which is how external compilation
units are expected to perform the inclusion.

In addition, this also removes the unneeded compat.h inclusion from
the announce example, this has been tested and is known to compile
on Windows with mingw / MSYS2.
  • Loading branch information
MathieuDuponchelle authored and chouquette committed Oct 8, 2019
1 parent 2a2e3cd commit a91b3ea
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion compat/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <string.h>

#include "compat.h"
#include "utils.h"
#include "microdns/utils.h"

#if defined (__unix__) || defined (__APPLE__)
struct timeval os_deadline = {
Expand Down
2 changes: 1 addition & 1 deletion compat/inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <string.h>

#include "compat.h"
#include "utils.h"
#include "microdns/utils.h"

#if defined (_WIN32) && !defined(HAVE_INET_NTOP)
const char *
Expand Down
2 changes: 1 addition & 1 deletion compat/poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <string.h>

#include "compat.h"
#include "utils.h"
#include "microdns/utils.h"

#ifndef HAVE_POLL
int poll(struct pollfd *fds, unsigned nfds, int timeout)
Expand Down
3 changes: 1 addition & 2 deletions examples/announce.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
#include <signal.h>
#include <string.h>

#include "microdns.h"
#include "compat.h"
#include <microdns/microdns.h>

volatile sig_atomic_t sigflag = 0;

Expand Down
2 changes: 1 addition & 1 deletion examples/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <unistd.h>
#include <signal.h>

#include "microdns.h"
#include <microdns/microdns.h>

volatile sig_atomic_t sigflag = 0;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ libcompat_sources = [
'compat/poll.c',
]

incdirs = include_directories('src', 'compat')
incdirs = include_directories('include', 'compat')

libcompat = static_library('compat', libcompat_sources,
include_directories: incdirs,
Expand All @@ -160,8 +160,8 @@ libmicrodns_sources = [
]

libmicrodns_headers = [
'src/microdns.h',
'src/rr.h',
'include/microdns/microdns.h',
'include/microdns/rr.h',
]

install_headers(libmicrodns_headers, subdir: 'microdns')
Expand Down
4 changes: 2 additions & 2 deletions src/mdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
#include <stdint.h>

#include "compat.h"
#include "utils.h"
#include "microdns.h"
#include "microdns/utils.h"
#include "microdns/microdns.h"

#define MDNS_PKT_MAXSZ 4096 // read/write buffer size

Expand Down
6 changes: 3 additions & 3 deletions src/rr.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
#include <stdlib.h>
#include <stdint.h>

#include "utils.h"
#include "microdns.h"
#include "rr.h"
#include "microdns/utils.h"
#include "microdns/microdns.h"
#include "microdns/rr.h"

typedef const uint8_t *(*rr_reader)(const uint8_t *, size_t *, const uint8_t *, struct rr_entry *);
typedef size_t (*rr_writer)(uint8_t *, const struct rr_entry *);
Expand Down

0 comments on commit a91b3ea

Please sign in to comment.