1 /*
2 * Copyright (C) 2004 Dizzy
3 *
4 * lstr is a structure to be used for cached string lengths for speed
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21 #ifndef INCLUDED_LSTR_TYPES
22 #define INCLUDED_LSTR_TYPES
23
24 typedef struct lstr {
25 char *str;
26 unsigned len;
27 } t_lstr;
28
29 #endif /* INCLUDED_LSTR_TYPES */
30
31 #ifndef INCLUDED_LSTR_PROTOS
32 #define INCLUDED_LSTR_PROTOS
33
lstr_set_str(t_lstr * lstr,char * str)34 static inline void lstr_set_str(t_lstr *lstr, char *str)
35 {
36 lstr->str = str;
37 }
38
lstr_get_str(t_lstr * lstr)39 static inline char *lstr_get_str(t_lstr *lstr)
40 {
41 return lstr->str;
42 }
43
lstr_set_len(t_lstr * lstr,unsigned len)44 static inline void lstr_set_len(t_lstr *lstr, unsigned len)
45 {
46 lstr->len = len;
47 }
48
lstr_get_len(t_lstr * lstr)49 static inline unsigned lstr_get_len(t_lstr *lstr)
50 {
51 return lstr->len;
52 }
53
54 #endif /* INCLUDED_LSTR_PROTOS */
55