mirror of
git://sourceware.org/git/lvm2.git
synced 2024-10-05 12:19:48 +03:00
util: add _dm_strncpy
Add internal inline function wrapper for dm_strncpy(). Use it for calls where we test the result. Avoids emitting warnings in Coverity for unchecked usage.
This commit is contained in:
parent
5c0ade35e2
commit
295e632e81
@ -35,6 +35,13 @@
|
||||
#define uninitialized_var(x) x = x
|
||||
#endif
|
||||
|
||||
/* Use wrapper for checked results */
|
||||
static inline __attribute__((warn_unused_result))
|
||||
int _dm_strncpy(char *dest, const char *src, size_t n)
|
||||
{
|
||||
return dm_strncpy(dest, src, n);
|
||||
}
|
||||
|
||||
/*
|
||||
* GCC 3.4 adds a __builtin_clz, which uses the count leading zeros (clz)
|
||||
* instruction on arches that have one. Provide a fallback using shifts
|
||||
|
@ -17,6 +17,13 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
/* Use wrapper for checked results */
|
||||
static inline __attribute__((warn_unused_result))
|
||||
int _dm_strncpy(char *dest, const char *src, size_t n)
|
||||
{
|
||||
return dm_strncpy(dest, src, n);
|
||||
}
|
||||
|
||||
#define min(a, b) ({ typeof(a) _a = (a); \
|
||||
typeof(b) _b = (b); \
|
||||
(void) (&_a == &_b); \
|
||||
|
Loading…
Reference in New Issue
Block a user