Skip to contentSkip to conversation

regex.3: Remove unnecessary include

PATCH In review Alejandro Colomar 2 participants 4 messages Oct 10, 2020 – Oct 11, 2020 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regex.3: Remove unnecessary include

POSIX requires that the <regex.h> header shall define the structures and symbolic constants used by the regcomp(), regexec(), regerror(), and regfree() functions.

Therefore, there should be no need to include <sys/types.h> at all.

The POSIX docs don't use that include:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/regcomp.html

---
 man3/regex.3 | 1 -
 1 file changed, 1 deletion(-)
man3/regex.3 +0 -1
index d4f7a09e7..414011d91 100644
@@ -32,7 +32,6 @@
 regcomp, regexec, regerror, regfree \- POSIX regex functions
 .SH SYNOPSIS
 .nf
-.B #include <sys/types.h>
 .B #include <regex.h>
 .PP
 .BI "int regcomp(regex_t *" preg ", const char *" regex ", int " cflags );
Signature · 1 line
2.28.0
#1 lore raw

Hi Michael,

I missed an example about these functions.
I'll send you one next week :)

Cheers

Alex

Quoted 27 lines · Alejandro Colomar

POSIX requires that the <regex.h> header shall define the structures and symbolic constants used by the regcomp(), regexec(), regerror(), and regfree() functions.

Therefore, there should be no need to include <sys/types.h> at all.

The POSIX docs don't use that include:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/regcomp.html

---
  man3/regex.3 | 1 -
  1 file changed, 1 deletion(-)
man3/regex.3 +0 -1
index d4f7a09e7..414011d91 100644
@@ -32,7 +32,6 @@
  regcomp, regexec, regerror, regfree \- POSIX regex functions
  .SH SYNOPSIS
  .nf
-.B #include <sys/types.h>
  .B #include <regex.h>
  .PP
  .BI "int regcomp(regex_t *" preg ", const char *" regex ", int " cflags );
#2 lore raw
Quoted 4 lines · Alejandro Colomar

Hi Michael,

I missed an example about these functions.
I'll send you one next week :)

Sounds good!

Cheers,

Michael

Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#3 lore raw
In reply to Alejandro Colomar
Quoted 5 lines · Alejandro Colomar

POSIX requires that the <regex.h> header shall define the structures and symbolic constants used by the regcomp(), regexec(), regerror(), and regfree() functions.

Therefore, there should be no need to include <sys/types.h> at all.

Thanls, Alex. Patch applied.

Cheers,

Michael

Quoted 21 lines

The POSIX docs don't use that include:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/regcomp.html

---
 man3/regex.3 | 1 -
 1 file changed, 1 deletion(-)
man3/regex.3 +0 -1
index d4f7a09e7..414011d91 100644
@@ -32,7 +32,6 @@
 regcomp, regexec, regerror, regfree \- POSIX regex functions
 .SH SYNOPSIS
 .nf
-.B #include <sys/types.h>
 .B #include <regex.h>
 .PP
 .BI "int regcomp(regex_t *" preg ", const char *" regex ", int " cflags );
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/