Beispiel #1
0
/*
 * Clones a pattern.
 *
 * Arguments:
 *      dst             Pointer to pointer to be set to the clone.  Set on and
 *                      only on success.
 *      src             The pattern to be cloned.
 * Returns:
 *      NULL            Success.
 *      else            Error object.
 */
ErrorObj*
pat_clone(
    Pattern** const             dst,
    const Pattern* const        src)
{
    return pat_new(dst, src->string, src->ignoreCase);
}
Beispiel #2
0
/*
 * Clones a pattern.
 *
 * Arguments:
 *      dst             Pointer to pointer to be set to the clone.  Set on and
 *                      only on success. Client should call "pat_free(*dst)"
 *                      when the pattern is no longer needed.
 *      src             The pattern to be cloned.
 * Returns:
 *      NULL            Success.
 *      else            Error object.
 */
ErrorObj*
pat_clone(
    Pattern** const             dst,
    const Pattern* const        src)
{
    if(&MATCH_ALL == src) {
        *dst = &MATCH_ALL;
        return NULL;
    }
        
    return pat_new(dst, src->string, src->ignoreCase);
}