memcpy(pattern[patterns], pat, len); pattern[patterns][len] = '\0';
if (wflag) { pattern[patterns] = grep_malloc(len + 15); snprintf(pattern[patterns], len + 15, "[[:<:]]%.*s[[:>:]]", (int)len, pat); } else { pattern[patterns] = grep_malloc(len + 1); memcpy(pattern[patterns], pat, len); pattern[patterns][len] = '\0'; }
add_pattern(char *pat, size_t len){	if (len == 0 || matchall) {		matchall = 1;		return;	}	if (patterns == pattern_sz) {		pattern_sz *= 2;		pattern = grep_realloc(pattern, ++pattern_sz * sizeof(*pattern));	}	if (pat[len - 1] == '\n')		--len;	pattern[patterns] = grep_malloc(len + 1);	/* pat may not be NUL-terminated */	memcpy(pattern[patterns], pat, len);	pattern[patterns][len] = '\0';	++patterns;	if (len > maxPatternLen)		maxPatternLen = len;}