RCube
Rcube Rest Server calculates sail routes based on Grib files and sailing boat polar files
Loading...
Searching...
No Matches
glibwrapper.h File Reference
#include <stddef.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
#include <stdlib.h>
#include <limits.h>
Include dependency graph for glibwrapper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define G_PI   3.14159265358979323846
 
#define MIN(i, j)   (((i) < (j)) ? (i) : (j))
 
#define MAX(i, j)   (((i) > (j)) ? (i) : (j))
 
#define CLAMP(x, lo, hi)   ( ((x) < (lo)) ? (lo) : ( ((x) > (hi)) ? (hi) : (x)) )
 
#define N_ELEMENTS(arr)   (sizeof(arr) / sizeof((arr)[0]))
 
#define g_strlcpy(dest, src, size)   strlcpy((dest),(src),(size))
 
#define g_strlcat(dest, src, size)   strlcat((dest),(src),(size))
 

Functions

static size_t g_strv_length (char *const *strv)
 
static void g_strfreev (char **strv)
 Free array with elements (like GLib g_strfreev)
 
static char ** g_strsplit (const char *string, const char *delimiter, int max_tokens)
 Clone of GLib g_strsplit.
 
static bool g_ascii_isspace (unsigned char c)
 GLib LIKE ' ', '\t', '
', '\v', '\f', '\r'.
 
static char * g_strstrip (char *s)
 Équivalent to GLIB g_strstrip: trim in place, return s.
 
static void g_strdelimit (char *s, const char *delims, char repl)
 
static char * g_strdup (const char *s)
 equivalent to GLIB
 
static char * g_path_get_basename (const char *path)
 close to Glib g_path_get_basename
 
static bool g_str_has_suffix (const char *s, const char *suffix)
 Equivalent to Glib g_str_has_suffix.
 
static bool g_str_has_prefix (const char *s, const char *prefix)
 Equivalent to Glib g_str_has_prefix.
 
static int g_atomic_int_get (int *x)
 Attention NOT SAFE.
 
static void g_atomic_int_set (int *x, int val)
 Attention NOT SAFE.
 

Macro Definition Documentation

◆ CLAMP

#define CLAMP (   x,
  lo,
  hi 
)    ( ((x) < (lo)) ? (lo) : ( ((x) > (hi)) ? (hi) : (x)) )

Definition at line 7 of file glibwrapper.h.

◆ G_PI

#define G_PI   3.14159265358979323846

Definition at line 4 of file glibwrapper.h.

◆ g_strlcat

#define g_strlcat (   dest,
  src,
  size 
)    strlcat((dest),(src),(size))

Definition at line 10 of file glibwrapper.h.

◆ g_strlcpy

#define g_strlcpy (   dest,
  src,
  size 
)    strlcpy((dest),(src),(size))

Definition at line 9 of file glibwrapper.h.

◆ MAX

#define MAX (   i,
 
)    (((i) > (j)) ? (i) : (j))

Definition at line 6 of file glibwrapper.h.

◆ MIN

#define MIN (   i,
 
)    (((i) < (j)) ? (i) : (j))

Definition at line 5 of file glibwrapper.h.

◆ N_ELEMENTS

#define N_ELEMENTS (   arr)    (sizeof(arr) / sizeof((arr)[0]))

Definition at line 8 of file glibwrapper.h.

Function Documentation

◆ g_ascii_isspace()

static bool g_ascii_isspace ( unsigned char  c)
inlinestatic

GLib LIKE ' ', '\t', '
', '\v', '\f', '\r'.

Definition at line 110 of file glibwrapper.h.

Referenced by g_strstrip(), and isEmpty().

Here is the caller graph for this function:

◆ g_atomic_int_get()

static int g_atomic_int_get ( int *  x)
inlinestatic

Attention NOT SAFE.

Definition at line 184 of file glibwrapper.h.

Referenced by allCompetitors(), bestTimeDeparture(), and routing().

Here is the caller graph for this function:

◆ g_atomic_int_set()

static void g_atomic_int_set ( int *  x,
int  val 
)
inlinestatic

Attention NOT SAFE.

Definition at line 189 of file glibwrapper.h.

Referenced by allCompetitors(), bestTimeDeparture(), initRouting(), and routingLaunch().

Here is the caller graph for this function:

◆ g_path_get_basename()

static char * g_path_get_basename ( const char *  path)
inlinestatic

close to Glib g_path_get_basename

Definition at line 147 of file glibwrapper.h.

Referenced by checkParamAndUpdate(), gribToStrJson(), logReport(), paramToStrJson(), routeToJson(), and statRoute().

Here is the caller graph for this function:

◆ g_str_has_prefix()

static bool g_str_has_prefix ( const char *  s,
const char *  prefix 
)
inlinestatic

Equivalent to Glib g_str_has_prefix.

Definition at line 177 of file glibwrapper.h.

Referenced by decodeHttpReq(), and listDirToStrJson().

Here is the caller graph for this function:

◆ g_str_has_suffix()

static bool g_str_has_suffix ( const char *  s,
const char *  suffix 
)
inlinestatic

Equivalent to Glib g_str_has_suffix.

Definition at line 167 of file glibwrapper.h.

Referenced by matchFilter(), and readPolar().

Here is the caller graph for this function:

◆ g_strdelimit()

static void g_strdelimit ( char *  s,
const char *  delims,
char  repl 
)
inlinestatic

Definition at line 135 of file glibwrapper.h.

Referenced by logRequest().

Here is the caller graph for this function:

◆ g_strdup()

static char * g_strdup ( const char *  s)
inlinestatic

equivalent to GLIB

Definition at line 142 of file glibwrapper.h.

◆ g_strfreev()

static void g_strfreev ( char **  strv)
inlinestatic

Free array with elements (like GLib g_strfreev)

Definition at line 30 of file glibwrapper.h.

Referenced by decodeHttpReq(), and readMarkCSVToJson().

Here is the caller graph for this function:

◆ g_strsplit()

static char ** g_strsplit ( const char *  string,
const char *  delimiter,
int  max_tokens 
)
inlinestatic

Clone of GLib g_strsplit.

Definition at line 37 of file glibwrapper.h.

Referenced by decodeHttpReq(), and readMarkCSVToJson().

Here is the caller graph for this function:

◆ g_strstrip()

static char * g_strstrip ( char *  s)
inlinestatic

Équivalent to GLIB g_strstrip: trim in place, return s.

Definition at line 115 of file glibwrapper.h.

References g_ascii_isspace().

Referenced by decodeHttpReq(), getRealIPAddress(), logRequest(), nearestPort(), readMarkCSVToJson(), and readParam().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ g_strv_length()

static size_t g_strv_length ( char *const *  strv)
inlinestatic

Definition at line 22 of file glibwrapper.h.