1 | #ifndef SHSTR_H__ |
1 | #ifndef SHSTR_H__ |
2 | #define SHSTR_H__ |
2 | #define SHSTR_H__ |
|
|
3 | |
|
|
4 | #include <sstream> |
3 | |
5 | |
4 | #include "util.h" |
6 | #include "util.h" |
5 | |
7 | |
6 | extern int buf_overflow (const char *buf1, const char *buf2, int bufsize); |
8 | extern int buf_overflow (const char *buf1, const char *buf2, int bufsize); |
7 | |
9 | |
… | |
… | |
111 | do_not_use_strcmp_to_compare_shstr_values (); |
113 | do_not_use_strcmp_to_compare_shstr_values (); |
112 | #endif |
114 | #endif |
113 | return a != b; |
115 | return a != b; |
114 | } |
116 | } |
115 | |
117 | |
|
|
118 | std::ostream &operator <<(std::ostream &o, const shstr &sh) |
|
|
119 | { |
|
|
120 | o.write (sh.s, sh.length ()); |
|
|
121 | return o; |
|
|
122 | } |
|
|
123 | |
116 | // only good for mass comparisons to shstr objects |
124 | // only good for mass comparisons to shstr objects |
117 | struct shstr_cmp |
125 | struct shstr_cmp |
118 | { |
126 | { |
119 | const char *s; |
127 | const char *s; |
120 | |
128 | |