src/protocols/telnet/settings.c
/**
 * Compiles the given regular expression, returning NULL if compilation fails
 * or of the given regular expression is NULL. The returned regex_t must be
 * freed with regfree() AND free(), or with guac_telnet_regex_free().
 *
 * @param user
 *     The user who provided the setting associated with the given regex
 *     pattern. Error messages will be logged on behalf of this user.
 *
 * @param pattern
 *     The regular expression pattern to compile.
 *
 * @return
 *     The compiled regular expression, or NULL if compilation fails or NULL
 *     was originally provided for the pattern.
 */
Compiles the given regular expression, returning NULL if compilation fails
or of the given regular expression is NULL. The returned regex_t must be
freed with regfree() AND free(), or with guac_telnet_regex_free().

@param user
The user who provided the setting associated with the given regex
pattern. Error messages will be logged on behalf of this user.

@param pattern
The regular expression pattern to compile.

@return
The compiled regular expression, or NULL if compilation fails or NULL
was originally provided for the pattern.
Compiles the given regular expression returning NULL if compilation fails or of the given regular expression is NULL . The returned regex_t must be freed with regfree () AND free () or with guac_telnet_regex_free () . @param user The user who provided the setting associated with the given regex pattern . Error messages will be logged on behalf of this user . @param pattern The regular expression pattern to compile . @return The compiled regular expression or NULL if compilation fails or NULL was originally provided for the pattern .
static regex_t* guac_telnet_compile_regex(guac_user* user, char* pattern) {
    if (pattern == NULL)
        return NULL;
    int compile_result;
    regex_t* regex = malloc(sizeof(regex_t));
    compile_result = regcomp(regex, pattern,
            REG_EXTENDED | REG_NOSUB | REG_ICASE | REG_NEWLINE);
    if (compile_result != 0) {
        guac_user_log(user, GUAC_LOG_ERROR, "Regular expression '%s' "
                "could not be compiled.", pattern);
        free(regex);
        return NULL;
    }
    return regex;
}
static regex_t * guac_telnet_compile_regex ( guac_user * user , char * pattern ) { if ( pattern == NULL ) return NULL ; int compile_result ; regex_t * regex = malloc ( sizeof ( regex_t ) ) ; compile_result = regcomp ( regex , pattern , REG_EXTENDED | REG_NOSUB | REG_ICASE | REG_NEWLINE ) ; if ( compile_result != 0 ) { guac_user_log ( user , GUAC_LOG_ERROR , " " " " , pattern ) ; free ( regex ) ; return NULL ; } return regex ; }
Compiles the given regular expression, returning NULL if compilation fails
 or of the given regular expression is NULL.
Compiles the given regular expression returning NULL if compilation fails or of the given regular expression is NULL .
/* Nothing to compile if no pattern provided */ /* Compile regular expression */ /* Notify of failure to parse/compile */