X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=blobdiff_plain;f=blob.h;h=a8ddce99a1c64c1fd8ae7b40254620ae291c805d;hp=ffd9f9abdd6f7abacbea2feeb9c8da05431aa7e0;hb=569bc29c5a0821ef24d5e679add2e1a61542ae91;hpb=a654d2f42b39a355524e8dbbe35b8f8e1671c1c6 diff --git a/blob.h b/blob.h index ffd9f9a..a8ddce9 100644 --- a/blob.h +++ b/blob.h @@ -26,8 +26,6 @@ #include #include -#if __BYTE_ORDER == __LITTLE_ENDIAN - #if defined(__linux__) || defined(__CYGWIN__) #include #include @@ -60,6 +58,8 @@ #define __LITTLE_ENDIAN LITTLE_ENDIAN #endif +#if __BYTE_ORDER == __LITTLE_ENDIAN + #define cpu_to_be64(x) bswap_64(x) #define cpu_to_be32(x) bswap_32(x) #define cpu_to_be16(x) bswap_16(x) @@ -242,6 +242,7 @@ extern void blob_nest_end(struct blob_buf *buf, void *cookie); extern struct blob_attr *blob_put(struct blob_buf *buf, int id, const void *ptr, int len); extern bool blob_check_type(const void *ptr, int len, int type); extern int blob_parse(struct blob_attr *attr, struct blob_attr **data, const struct blob_attr_info *info, int max); +extern struct blob_attr *blob_memdup(struct blob_attr *attr); static inline struct blob_attr * blob_put_string(struct blob_buf *buf, int id, const char *str)