mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
doc: add note about call to "regfree" after call to "string_regcomp" (plugin API reference)
This commit is contained in:
@@ -1334,14 +1334,25 @@ Return value:
|
||||
* same return code as function `regcomp` (0 if OK, other value for error,
|
||||
see `man regcomp`)
|
||||
|
||||
[NOTE]
|
||||
Regular expression _preg_ must be cleaned by calling "regfree" after use,
|
||||
if the function returned 0 (OK).
|
||||
|
||||
C example:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
regex_t my_regex;
|
||||
if (weechat_string_regcomp (&my_regex, "(?i)test", REG_EXTENDED) != 0)
|
||||
if (weechat_string_regcomp (&my_regex, "(?i)test", REG_EXTENDED) == 0)
|
||||
{
|
||||
/* OK */
|
||||
/* ... */
|
||||
regfree (&my_regex);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* error */
|
||||
/* ... */
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
@@ -1355,14 +1355,25 @@ Valeur de retour :
|
||||
* même code retour que la fonction `regcomp` (0 si ok, autre valeur pour une
|
||||
erreur, voir `man regcomp`)
|
||||
|
||||
[NOTE]
|
||||
L'expression régulière _preg_ doit être nettoyée par un appel à "regfree" après
|
||||
utilisation, si la fonction a retourné 0 (OK).
|
||||
|
||||
Exemple en C :
|
||||
|
||||
[source,C]
|
||||
----
|
||||
regex_t my_regex;
|
||||
if (weechat_string_regcomp (&my_regex, "(?i)test", REG_EXTENDED) != 0)
|
||||
if (weechat_string_regcomp (&my_regex, "(?i)test", REG_EXTENDED) == 0)
|
||||
{
|
||||
/* OK */
|
||||
/* ... */
|
||||
regfree (&my_regex);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* erreur */
|
||||
/* ... */
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
@@ -1400,14 +1400,26 @@ Valore restituito:
|
||||
* same return code as function `regcomp` (0 if ok, other value for error,
|
||||
see `man regcomp`)
|
||||
|
||||
[NOTE]
|
||||
// TRANSLATION MISSING
|
||||
Regular expression _preg_ must be cleaned by calling "regfree" after use,
|
||||
if the function returned 0 (OK).
|
||||
|
||||
Esempio in C:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
regex_t my_regex;
|
||||
if (weechat_string_regcomp (&my_regex, "(?i)test", REG_EXTENDED) != 0)
|
||||
if (weechat_string_regcomp (&my_regex, "(?i)test", REG_EXTENDED) == 0)
|
||||
{
|
||||
/* OK */
|
||||
/* ... */
|
||||
regfree (&my_regex);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* error */
|
||||
/* ... */
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
@@ -1344,14 +1344,26 @@ int weechat_string_regcomp (void *preg, const char *regex, int default_flags)
|
||||
* `regcomp` 関数と同じ戻り値
|
||||
(成功の場合は 0、エラーが起きた場合は 0 以外、`man regcomp` を参照)
|
||||
|
||||
[NOTE]
|
||||
// TRANSLATION MISSING
|
||||
Regular expression _preg_ must be cleaned by calling "regfree" after use,
|
||||
if the function returned 0 (OK).
|
||||
|
||||
C 言語での使用例:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
regex_t my_regex;
|
||||
if (weechat_string_regcomp (&my_regex, "(?i)test", REG_EXTENDED) != 0)
|
||||
if (weechat_string_regcomp (&my_regex, "(?i)test", REG_EXTENDED) == 0)
|
||||
{
|
||||
/* OK */
|
||||
/* ... */
|
||||
regfree (&my_regex);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* error */
|
||||
/* ... */
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
@@ -1300,6 +1300,8 @@ string_regex_flags (const char *regex, int default_flags, int *flags)
|
||||
* Returns:
|
||||
* 0: successful compilation
|
||||
* other value: compilation failed
|
||||
*
|
||||
* Note: regex must be freed with regfree after use.
|
||||
*/
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user