Skip to content

Commit

Permalink
A better feature test for fnmatch (POSIX.1-2001)
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Dec 17, 2024
1 parent b7eb228 commit 597d2f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 2 additions & 3 deletions include/redisx.h
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,8 @@ int redisxPublishAsync(Redis *redis, const char *channel, const char *data, int
int redisxError(const char *func, int errorCode);
const char* redisxErrorDescription(int code);

// The following is not available on prior to the POSIX.1-2008 standard
// We'll use the __STDC_VERSION__ constant as a proxy to see if fnmatch is available
#if __STDC_VERSION__ > 201112L
// The following is not available on prior to the POSIX.1-2001 standard
#if _POSIX_C_SOURCE >= 200112L
int redisxDeleteEntries(Redis *redis, const char *pattern);
#endif

Expand Down
5 changes: 2 additions & 3 deletions src/redisx-tab.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,9 +896,8 @@ void redisxDestroyKeys(char **keys, int count) {
free(keys);
}

// The following is not available on prior to the POSIX.1-2008 standard
// We'll use the __STDC_VERSION__ constant as a proxy to see if fnmatch is available
#if __STDC_VERSION__ > 201112L
// The following is not available on prior to the POSIX.1-2001 standard
#if _POSIX_C_SOURCE >= 200112L

/**
* Removes all Redis entries that match the specified table:field name pattern.
Expand Down
5 changes: 2 additions & 3 deletions test/src/test-tab.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,8 @@ int main() {
free(e);


#if __STDC_VERSION__ > 201112L
// The following is not available on prior to the POSIX.1-2008 standard
// We'll use the __STDC_VERSION__ constant as a proxy to see if fnmatch is available
#if _POSIX_C_SOURCE >= 200112L
// The following is not available on prior to the POSIX.1-2001 standard

n1 = redisxDeleteEntries(redis, "_*:_extra_");
if(n1 < 0) {
Expand Down

0 comments on commit 597d2f1

Please sign in to comment.