| 1 | /* -*- c-basic-offset: 2 -*- */ |
| 2 | /* |
| 3 | Copyright(C) 2016-2017 Brazil |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License version 2.1 as published by the Free Software Foundation. |
| 8 | |
| 9 | This library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with this library; if not, write to the Free Software |
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | */ |
| 18 | |
| 19 | #include "grn_raw_string.h" |
| 20 | #include "grn_str.h" |
| 21 | |
| 22 | void |
| 23 | grn_raw_string_lstrip(grn_ctx *ctx, |
| 24 | grn_raw_string *string) |
| 25 | { |
| 26 | const char *end; |
| 27 | int space_len; |
| 28 | |
| 29 | end = string->value + string->length; |
| 30 | while (string->value < end) { |
| 31 | space_len = grn_isspace(string->value, ctx->encoding); |
| 32 | if (space_len == 0) { |
| 33 | break; |
| 34 | } |
| 35 | string->value += space_len; |
| 36 | string->length -= space_len; |
| 37 | } |
| 38 | } |
| 39 | |