Explorar el Código

- str formatting macro by Bogdan Pintea
closes SER-127

Jan Janak hace 19 años
padre
commit
374f5e864a
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      str.h

+ 3 - 0
str.h

@@ -40,4 +40,7 @@ typedef struct _str str;
 #define STR_STATIC_INIT(v) {(v), sizeof(v) - 1}
 #define STR_STATIC_INIT(v) {(v), sizeof(v) - 1}
 #define STR_NULL {NULL, 0}
 #define STR_NULL {NULL, 0}
 
 
+#define STR_FMT(_pstr_)	\
+  ((_pstr_) ? (_pstr_)->len : 0), ((_pstr_) ? (_pstr_)->s : "")
+
 #endif
 #endif