Skip to content

Commit

Permalink
Update to first major version 1.0.0 (#60)
Browse files Browse the repository at this point in the history
Added static_assert to verify composed version string matches the individual version components
  • Loading branch information
moticless authored Nov 10, 2024
1 parent 2fdfc0c commit c387527
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions src/lib/version.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <stddef.h>
#include <assert.h>

#include "version.h"

#define STATIC_ASSERT(COND,MSG) typedef char static_assertion[(COND)?1:-1]

#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define LIBRDB_COMPOSED_VERSION_STRING TOSTRING(LIBRDB_MAJOR_VERSION) "." \
TOSTRING(LIBRDB_MINOR_VERSION) "." \
TOSTRING(LIBRDB_PATCH_VERSION)

/* Verify that the composed version string matches the individual version components */
STATIC_ASSERT(
(sizeof(LIBRDB_VERSION_STRING) == sizeof(LIBRDB_COMPOSED_VERSION_STRING)) &&
(__builtin_strcmp(LIBRDB_VERSION_STRING, LIBRDB_COMPOSED_VERSION_STRING) == 0),
"LIBRDB_VERSION_STRING does not match the individual version components"
);
6 changes: 3 additions & 3 deletions src/lib/version.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#define LIBRDB_MAJOR_VERSION 0
#define LIBRDB_MAJOR_VERSION 1
#define LIBRDB_MINOR_VERSION 0
#define LIBRDB_PATCH_VERSION 1
#define LIBRDB_PATCH_VERSION 0

/* Keep direct value for external readers */
#define LIBRDB_VERSION_STRING "0.0.1"
#define LIBRDB_VERSION_STRING "1.0.0"

/* Update Maximum supported RDB version */
#define LIBRDB_SUPPORT_MAX_RDB_VER 12

0 comments on commit c387527

Please sign in to comment.