1
0
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:
Sébastien Helleu
2021-01-01 18:10:47 +01:00
parent d413ccdf4f
commit 943374f789
5 changed files with 52 additions and 4 deletions
+12 -1
View File
@@ -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 */
/* ... */
}
----
+12 -1
View File
@@ -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 */
/* ... */
}
----
+13 -1
View File
@@ -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 */
/* ... */
}
----
+13 -1
View File
@@ -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 */
/* ... */
}
----
+2
View File
@@ -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