Back to index

php5  5.3.10
mbfl_string.c
Go to the documentation of this file.
00001 /*
00002  * "streamable kanji code filter and converter"
00003  * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved.
00004  *
00005  * LICENSE NOTICES
00006  *
00007  * This file is part of "streamable kanji code filter and converter",
00008  * which is distributed under the terms of GNU Lesser General Public 
00009  * License (version 2) as published by the Free Software Foundation.
00010  *
00011  * This software is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with "streamable kanji code filter and converter";
00018  * if not, write to the Free Software Foundation, Inc., 59 Temple Place,
00019  * Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  * The author of this file:
00022  *
00023  */
00024 /*
00025  * The source code included in this files was separated from mbfilter.c
00026  * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file
00027  * mbfilter.c is included in this package .
00028  *
00029  */
00030 
00031 #ifdef HAVE_CONFIG_H
00032 #include "config.h"
00033 #endif
00034 
00035 #ifdef HAVE_STDDEF_H
00036 #include <stddef.h>
00037 #endif
00038 
00039 #include "mbfl_allocators.h"
00040 #include "mbfl_string.h"
00041 
00042 /*
00043  * string object
00044  */
00045 void
00046 mbfl_string_init(mbfl_string *string)
00047 {
00048        if (string) {
00049               string->no_language = mbfl_no_language_uni;
00050               string->no_encoding = mbfl_no_encoding_pass;
00051               string->val = (unsigned char*)NULL;
00052               string->len = 0;
00053        }
00054 }
00055 
00056 void
00057 mbfl_string_init_set(mbfl_string *string, mbfl_language_id no_language, mbfl_encoding_id no_encoding)
00058 {
00059        if (string) {
00060               string->no_language = no_language;
00061               string->no_encoding = no_encoding;
00062               string->val = (unsigned char*)NULL;
00063               string->len = 0;
00064        }
00065 }
00066 
00067 void
00068 mbfl_string_clear(mbfl_string *string)
00069 {
00070        if (string) {
00071               if (string->val != (unsigned char*)NULL) {
00072                      mbfl_free(string->val);
00073               }
00074               string->val = (unsigned char*)NULL;
00075               string->len = 0;
00076        }
00077 }
00078 
00079