| 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 | namespace pvpgn |
| 25 | { |
| 26 | |
| 27 | typedef struct lstr { |
| 28 | char *str; |
| 29 | unsigned len; |
| 30 | } t_lstr; |
| 31 | |
| 32 | } |
| 33 | |
| 34 | #endif /* INCLUDED_LSTR_TYPES */ |
| 35 | |
| 36 | #ifndef INCLUDED_LSTR_PROTOS |
| 37 | #define INCLUDED_LSTR_PROTOS |
| 38 | |
| 39 | namespace pvpgn |
| 40 | { |
| 41 | |
| 42 | static inline void lstr_set_str(t_lstr *lstr, char *str) |
| 43 | { |
| 44 | lstr->str = str; |
| 45 | } |
| 46 | |
| 47 | static inline char *lstr_get_str(t_lstr *lstr) |
| 48 | { |
| 49 | return lstr->str; |
| 50 | } |
| 51 | |
| 52 | static inline void lstr_set_len(t_lstr *lstr, unsigned len) |
| 53 | { |
| 54 | lstr->len = len; |
| 55 | } |
| 56 | |
| 57 | static inline unsigned lstr_get_len(t_lstr *lstr) |
| 58 | { |
| 59 | return lstr->len; |
| 60 | } |
| 61 | |
| 62 | } |
| 63 | |
| 64 | #endif /* INCLUDED_LSTR_PROTOS */ |