关于pcre正则表达式lib [英] about pcre regex lib
问题描述
我使用prce匹配字符串。我定义了一个pcre结构点,然后
编译,将pcre结构点传递给''pcre_compile''。
完成后,是否有必要使用' 'pcre_free''释放pcre struct
点。
例如:
...... 。
pcre * re;
const char * errorptr;
int erroroffset;
re = pcre_compile(" pattern",0& errorptr,& erroroffset,0);
.....做同样的事..... br />
if(re!= NULL)
{
pcre_free(re);
re = NULL;
}
.......
而且,''pcre_free''线程安全???
-
Hello World
2006年7月11日星期二22:08:36 +0000,大陆< ma ****** @ gmail.com>
在comp.lang.c中写道:
< blockquote class =post_quotes>
>
我使用prce来matc h字符串。我定义了一个pcre结构点,然后
编译,将pcre struct point传递给''pcre_compile''。
不属于标准C语言的第三方库在这里是
偏离主题。
完成后,是否有必要使用''pcre_free''释放pcre struct
point。
如果这个
信息不在文档中,您需要在支持该库的组或列表中询问。您确实阅读了
文档?
例如:
......
pcre * re;
const char * errorptr;
int erroroffset;
re = pcre_compile(" pattern",0& errorptr,& erroroffset,0);
....做同样的事情......
if(re!= NULL)
{
pcre_free(re);
re = NULL;
}
......
并且,''pcre_free''线程安全吗? ??
C语言没有以任何方式定义或支持线程,形状,
或表格。同样,您需要查阅图书馆的文档,或者在支持它的新闻组或邮件列表中查询
。或者只是支持你的编译器/操作系统组合的
。
-
Jack Klein >
主页: http://JK-Technology.Com
常见问题解答
comp.lang.c http:// c-faq.com/
comp.lang.c ++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c ++
< a rel =nofollowhref =http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html\"target =_ blank> http://www.contrib.andrew。 cmu.edu/~a...FAQ-acllc.html
Mainland写道:
我使用prce来匹配字符串。我定义了一个pcre结构点,然后
编译,将pcre结构点传递给''pcre_compile''。
完成后,是否有必要使用' 'pcre_free''释放pcre struct
点。
例如:
......
pcre * re;
const char * errorptr;
int erroroffset;
re = pcre_compile(" pattern",0& errorptr,& erroroffset,0);
....做同样的事情......
if(re!= NULL)
{
pcre_free(re);
re = NULL;
}
......
并且,''pcre_free''线程安全吗? ??
是的,你应该调用pcre_free_substring或pcre_free(重新)
由于pcre_free可以被库的用户更改,
你的问题毫无意义。这取决于哪个函数是
pcre free。
lcc-win32提供pcre.lib作为标准,默认情况下pcre_free是
来自标准库的函数free(),它是lcc-win32使用的实现中的线程安全的
。我不能为其他
编译器说什么,但我怀疑大多数fre()实现
都是线程安全的。
Jack Klein写道:
On Tue,2006年7月11日22:08:36 +0000,大陆< ma ****** @ gmail.com>
在comp.lang.c中写道:
>>我使用prce来匹配字符串。我定义了一个pcre结构点,然后编译,将pcre struct point传递给''pcre_compile''。
不属于标准C语言的第三方库是
这里的主题。
也许,pcre(代表Perl兼容的正则表达式)
是一个非常受欢迎的库,我认为它不是主题
您的意见当然可能有所不同。
>
C语言没有以任何方式定义或支持线程,形状,
或表单。同样,您需要查阅图书馆的文档,或者在支持它的新闻组或邮件列表中查询
。或者只是
可能,在一个支持你的编译器/操作系统组合的组中。
我认为线程(现在是POSIX标准和也出现在
windows)中是一个生活中的事实。在现代编程中你不能忽视它们
jacob
I use prce to match string. I define a pcre struct point, then
compile, pass pcre struct point to ''pcre_compile''.
When complete, Is it necessary to use ''pcre_free'' to free pcre struct
point.
example:
.......
pcre *re;
const char* errorptr;
int erroroffset;
re = pcre_compile ( "pattern", 0 , &errorptr, &erroroffset, 0);
..... do samething .....
if ( re != NULL )
{
pcre_free ( re );
re = NULL;
}
.......
And, Is ''pcre_free'' thread safe ???
--
Hello World
On Tue, 11 Jul 2006 22:08:36 +0000, mainland <ma******@gmail.com>
wrote in comp.lang.c:
>
I use prce to match string. I define a pcre struct point, then
compile, pass pcre struct point to ''pcre_compile''.Third party libraries that are not part of the standard C language are
off-topic here.
When complete, Is it necessary to use ''pcre_free'' to free pcre struct
point.You need to ask in a group or list that supports this library, if this
information is not in the documentation. You did read the
documentation?
example:
......
pcre *re;
const char* errorptr;
int erroroffset;
re = pcre_compile ( "pattern", 0 , &errorptr, &erroroffset, 0);
.... do samething .....
if ( re != NULL )
{
pcre_free ( re );
re = NULL;
}
......
And, Is ''pcre_free'' thread safe ???The C language does not define or support threads in any way, shape,
or form. Again, you need to consult the library''s documentation, or
ask in a newsgroup or mailing list that supports it. Or just
possibly, in a group that supports your compiler/OS combination.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
mainland wrote:I use prce to match string. I define a pcre struct point, then
compile, pass pcre struct point to ''pcre_compile''.
When complete, Is it necessary to use ''pcre_free'' to free pcre struct
point.
example:
......
pcre *re;
const char* errorptr;
int erroroffset;
re = pcre_compile ( "pattern", 0 , &errorptr, &erroroffset, 0);
.... do samething .....
if ( re != NULL )
{
pcre_free ( re );
re = NULL;
}
......
And, Is ''pcre_free'' thread safe ???
Yes, you should call pcre_free_substring or pcre_free (re)
Since pcre_free can be changed by the user of the library,
your question has no sense. It depends which function is
pcre free.
lcc-win32 offers pcre.lib as standard, and by default there pcre_free is
the function free() from the standard library, that is thread safe in
the implementation used by lcc-win32. I can''t say anything for other
compilers but I would suspect that most of the fre() implementations
are thread safe.
Jack Klein wrote:On Tue, 11 Jul 2006 22:08:36 +0000, mainland <ma******@gmail.com>
wrote in comp.lang.c:
>>I use prce to match string. I define a pcre struct point, then
compile, pass pcre struct point to ''pcre_compile''.
Third party libraries that are not part of the standard C language are
off-topic here.
Maybe, pcre (stands for Perl compatible regular expressions)
is a very popular library, and I consider that it is not off topic
Your opinion may differ of course.
>
The C language does not define or support threads in any way, shape,
or form. Again, you need to consult the library''s documentation, or
ask in a newsgroup or mailing list that supports it. Or just
possibly, in a group that supports your compiler/OS combination.
I think threads (that are now a POSIX standard and also present in
windows) are a "fact of life". You can''t ignore them in modern programming
jacob
这篇关于关于pcre正则表达式lib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!