ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/shstr.h
(Generate patch)

Comparing deliantra/server/include/shstr.h (file contents):
Revision 1.11 by root, Thu Sep 14 21:16:12 2006 UTC vs.
Revision 1.13 by root, Mon Apr 23 15:27:46 2007 UTC

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
6extern int buf_overflow (const char *buf1, const char *buf2, int bufsize); 8extern int buf_overflow (const char *buf1, const char *buf2, int bufsize);
7 9
99inline int strlen (const shstr &sh) 101inline int strlen (const shstr &sh)
100{ 102{
101 return sh.length (); 103 return sh.length ();
102} 104}
103 105
106inline int strcmp (const shstr &a, const shstr &b)
107{
108 // TODO: use this to find all the occurences of people using strcmp
109 // all uses should be bogus, as we should be never interested in
110 // comparing shstr's alphabetically
111#if 0
112 extern void do_not_use_strcmp_to_compare_shstr_values ();
113 do_not_use_strcmp_to_compare_shstr_values ();
114#endif
115 return a != b;
116}
117
118std::ostream &operator <<(std::ostream &o, const shstr &sh)
119{
120 o.write (sh.s, sh.length ());
121 return o;
122}
123
104// only good for mass comparisons to shstr objects 124// only good for mass comparisons to shstr objects
105struct shstr_cmp 125struct shstr_cmp
106{ 126{
107 const char *s; 127 const char *s;
108 128

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines