Skip to content

Commit

Permalink
chore: add version to agent (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
zfields authored Jun 20, 2024
1 parent 622e19f commit de8f26a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion n_ua.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "n_lib.h"

// Override-able statics
static char *n_agent = (char *) "note-c";
static char *n_agent = (char *) ("note-c" " " NOTE_C_VERSION);
static int n_cpu_cores = 0;
static int n_cpu_mem = 0;
static int n_cpu_mhz = 0;
Expand Down
8 changes: 5 additions & 3 deletions note.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@
#include <stdbool.h>
#include <stdint.h>

#define _NOTE_C_STRINGIZE(x) #x
#define NOTE_C_STRINGIZE(x) _NOTE_C_STRINGIZE(x)

#define NOTE_C_VERSION_MAJOR 2
#define NOTE_C_VERSION_MINOR 1
#define NOTE_C_VERSION_PATCH 3

#define NOTE_C_VERSION NOTE_C_STRINGIZE(NOTE_C_VERSION_MAJOR) "." NOTE_C_STRINGIZE(NOTE_C_VERSION_MINOR) "." NOTE_C_STRINGIZE(NOTE_C_VERSION_PATCH)

// If double and float are the same size, then we must be on a small MCU. Turn
// on NOTE_C_LOW_MEM to conserve memory.
#if defined(FLT_MAX_EXP) && defined(DBL_MAX_EXP)
Expand Down Expand Up @@ -333,9 +338,6 @@ void NoteDebugf(const char *format, ...);
void NoteDebugWithLevel(uint8_t level, const char *msg);
void NoteDebugWithLevelLn(uint8_t level, const char *msg);

#define _NOTE_C_STRINGIZE(x) #x
#define NOTE_C_STRINGIZE(x) _NOTE_C_STRINGIZE(x)

#ifdef NOTE_C_LOG_SHOW_FILE_AND_LINE
#define NOTE_C_LOG_FILE_AND_LINE(lvl) do { \
NoteDebugWithLevel(lvl, __FILE__ ":" NOTE_C_STRINGIZE(__LINE__) " "); \
Expand Down

0 comments on commit de8f26a

Please sign in to comment.