Make these definitions weak in libc, so POSIX programs can redefine these names if they don't use our functions, and still use regcomp/regexec above without link errors. */
(s)
| 687 | |
| 688 | char * |
| 689 | # ifdef _LIBC |
| 690 | /* Make these definitions weak in libc, so POSIX programs can redefine |
| 691 | these names if they don't use our functions, and still use |
| 692 | regcomp/regexec above without link errors. */ |
| 693 | weak_function |
| 694 | # endif |
| 695 | re_comp (s) |
| 696 | const char *s; |
| 697 | { |
| 698 | reg_errcode_t ret; |
| 699 | char *fastmap; |
| 700 | |
| 701 | if (!s) |
| 702 | { |
| 703 | if (!re_comp_buf.buffer) |
| 704 | return gettext ("No previous regular expression"); |
| 705 | return 0; |
| 706 | } |
| 707 | |
| 708 | if (re_comp_buf.buffer) |
| 709 | { |
| 710 | fastmap = re_comp_buf.fastmap; |
| 711 | re_comp_buf.fastmap = NULL; |
| 712 | __regfree (&re_comp_buf); |
| 713 | memset (&re_comp_buf, '\0', sizeof (re_comp_buf)); |
| 714 | re_comp_buf.fastmap = fastmap; |
| 715 | } |
| 716 | |
| 717 | if (re_comp_buf.fastmap == NULL) |
| 718 | { |
| 719 | re_comp_buf.fastmap = (char *) malloc (SBC_MAX); |
| 720 | if (re_comp_buf.fastmap == NULL) |
| 721 | return (char *) gettext (__re_error_msgid |
| 722 | + __re_error_msgid_idx[(int) REG_ESPACE]); |
| 723 | } |
| 724 | |
| 725 | /* Since `re_exec' always passes NULL for the `regs' argument, we |
| 726 | don't need to initialize the pattern buffer fields which affect it. */ |
| 727 | |
| 728 | /* Match anchors at newlines. */ |
| 729 | re_comp_buf.newline_anchor = 1; |
| 730 | |
| 731 | ret = re_compile_internal (&re_comp_buf, s, strlen (s), re_syntax_options); |
| 732 | |
| 733 | if (!ret) |
| 734 | return NULL; |
| 735 | |
| 736 | /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */ |
| 737 | return (char *) gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]); |
nothing calls this directly
no test coverage detected