X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=common%2Fstr.h;h=bd2d052ba40a42a487e715ae050978d25bde09d1;hb=41b82fa1b8fbad44a1cc7671bd614b016b2c38b8;hp=bc1cf9e738b99dc6d37846baae730fd654b48ff8;hpb=8977d252fc44ae953df4bde4a2f1c5895beea4e0;p=apps%2Fpfixtools.git diff --git a/common/str.h b/common/str.h index bc1cf9e..bd2d052 100644 --- a/common/str.h +++ b/common/str.h @@ -371,5 +371,18 @@ m_stristr(const char *haystack, const char *needle) { return m_stristrn(haystack, needle, m_strlen(needle)); } +/****************************************************************************/ +/* static strings */ +/****************************************************************************/ + +/** Store a pointer to a string with a pre-computed length. + * This intends to store pointers to a part of a longer string and to avoid + * useless strlen. + */ +typedef struct static_str_t { + const char *str; + ssize_t len; +} static_str_t; + /*@}*/ #endif /* PFIXTOOLS_STR_H */