mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
tools/logparser.c: A few more minor enhancements. Also add #define _GNU_SOURCE to all C files that call asprintf()
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|||||||
+19
-12
@@ -37,6 +37,7 @@
|
|||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
@@ -462,6 +463,7 @@ static void parse_file(FILE *stream)
|
|||||||
if (isspace(g_line[0]))
|
if (isspace(g_line[0]))
|
||||||
{
|
{
|
||||||
char *endptr;
|
char *endptr;
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
/* Remove the newline from the end */
|
/* Remove the newline from the end */
|
||||||
|
|
||||||
@@ -469,21 +471,24 @@ static void parse_file(FILE *stream)
|
|||||||
endptr = &ptr[strlen(ptr) - 1];
|
endptr = &ptr[strlen(ptr) - 1];
|
||||||
trim_end(ptr, endptr);
|
trim_end(ptr, endptr);
|
||||||
|
|
||||||
/* Skip over certain crap lines added by GIT; Skip over
|
/* Change leading "* " to "- " */
|
||||||
* merge entries.
|
|
||||||
|
tmp = ptr;
|
||||||
|
if (ptr[0] == '*' && ptr[1] == ' ')
|
||||||
|
{
|
||||||
|
*ptr = '-';
|
||||||
|
tmp = ptr + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Skip over certain crap body lines added by GIT; Skip over
|
||||||
|
* merge entries altogether.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (strncmp(ptr, "Merged in ", 10) != 0 &&
|
if (strncmp(tmp, "Merged in ", 10) != 0 &&
|
||||||
strncmp(ptr, "Approved-by: ", 13) != 0 &&
|
strncmp(tmp, "Approved-by: ", 13) != 0 &&
|
||||||
|
strncmp(tmp, "Signed-off-by: ", 15) != 0 &&
|
||||||
!merge)
|
!merge)
|
||||||
{
|
{
|
||||||
/* Change leading "* " to "- " */
|
|
||||||
|
|
||||||
if (ptr[0] == '*' && ptr[1] == ' ')
|
|
||||||
{
|
|
||||||
*ptr = '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Is this the first paragraph in the body? */
|
/* Is this the first paragraph in the body? */
|
||||||
|
|
||||||
if (firstline)
|
if (firstline)
|
||||||
@@ -492,7 +497,9 @@ static void parse_file(FILE *stream)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Was this paragraph preceded by a blank line? */
|
/* This paragraph is not the first, was it separated
|
||||||
|
* from the previous paragraph by a blank line?
|
||||||
|
*/
|
||||||
|
|
||||||
if (lastblank)
|
if (lastblank)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user