Motr  M0
string.h File Reference
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lib/types.h"
Include dependency graph for string.h:

Go to the source code of this file.

Data Structures

struct  m0_fop_str
 

Macros

#define __MOTR_LIB_STRING_H__
 
#define m0_streq(a, b)   (strcmp((a), (b)) == 0)
 
#define m0_strcaseeq(a, b)   (strcasecmp((a), (b)) == 0)
 
#define m0_strdup(s)   strdup((s))
 
#define m0_asprintf(s, fmt, ...)
 

Functions

struct m0_fop_str M0_XCA_DOMAIN (rpc)
 
const char * m0_bcount_with_suffix (char *buf, size_t size, m0_bcount_t c)
 
M0_INTERNAL void m0_strings_free (const char **arr)
 
M0_INTERNAL const char ** m0_strings_dup (const char **src)
 
M0_INTERNAL char * m0_vsnprintf (char *buf, size_t buflen, const char *format,...) __attribute__((format(printf
 
M0_INTERNAL char M0_INTERNAL bool m0_startswith (const char *prefix, const char *str)
 

Variables

uint32_t s_len
 
uint8_t * s_buf
 

Macro Definition Documentation

◆ __MOTR_LIB_STRING_H__

#define __MOTR_LIB_STRING_H__

Definition at line 26 of file string.h.

◆ m0_asprintf

#define m0_asprintf (   s,
  fmt,
  ... 
)
Value:
({ \
int __nr; \
char **__s = (s); \
__nr = asprintf(__s, (fmt), __VA_ARGS__); \
if (__nr <= 0) \
*__s = NULL; \
})
#define NULL
Definition: misc.h:38
char * fmt(const char *format,...) __attribute__((format(printf
static struct m0_addb2_source * s
Definition: consumer.c:39

Definition at line 44 of file string.h.

◆ m0_strcaseeq

#define m0_strcaseeq (   a,
 
)    (strcasecmp((a), (b)) == 0)

Definition at line 35 of file string.h.

◆ m0_strdup

#define m0_strdup (   s)    strdup((s))

Definition at line 43 of file string.h.

◆ m0_streq

#define m0_streq (   a,
 
)    (strcmp((a), (b)) == 0)

Definition at line 34 of file string.h.

Function Documentation

◆ m0_bcount_with_suffix()

const char* m0_bcount_with_suffix ( char *  buf,
size_t  size,
m0_bcount_t  c 
)

Converts m0_bcount_t number into a reduced string representation, calculating a magnitude and representing it as standard suffix like "Ki", "Mi", "Gi" etc. So, for example, 87654321 becomes "83 Mi".

Definition at line 32 of file string.c.

Here is the caller graph for this function:

◆ m0_startswith()

M0_INTERNAL char M0_INTERNAL bool m0_startswith ( const char *  prefix,
const char *  str 
)

Returns true iff ‘str’ starts with the specified ‘prefix’.

Definition at line 98 of file string.c.

Here is the caller graph for this function:

◆ m0_strings_dup()

M0_INTERNAL const char** m0_strings_dup ( const char **  src)

Definition at line 55 of file string.c.

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

◆ m0_strings_free()

M0_INTERNAL void m0_strings_free ( const char **  arr)

Definition at line 45 of file string.c.

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

◆ m0_vsnprintf()

M0_INTERNAL char* m0_vsnprintf ( char *  buf,
size_t  buflen,
const char *  format,
  ... 
)

◆ M0_XCA_DOMAIN()

struct m0_fop_str M0_XCA_DOMAIN ( rpc  )

Variable Documentation

◆ s_buf

uint8_t* s_buf

Definition at line 100 of file string.h.

◆ s_len

uint32_t s_len

Definition at line 99 of file string.h.