Skip to content

Commit

Permalink
Fixed detection issue with function returning pointer to function
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Gautier committed Nov 17, 2016
1 parent 0443994 commit 3959667
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion betty-doc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2839,7 +2839,7 @@ ($)
print STDERR "${file}:$.: warning: no description found for function $1\n";
++$warnings;
}
elsif ($_ =~ /^(?:(?:$Storage|$Inline)\s*)*\s*($Type)\s*\(\**($Ident)\s*\((.*)\)\)\(/s)
elsif ($_ =~ /^(?:(?:$Storage|$Inline)\s*)*\s*($Type)\s*\(\**($Ident)\s*\((.*)\)\)\s*\(/s)
{
my $type_ = $1;
my $func_ = $2;
Expand Down
31 changes: 31 additions & 0 deletions tests/doc/doc9.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,34 @@ int (*get_op_func(char *s))(int, int)
}
return (NULL);
}

/**
* get_op_func - Get operator function
*
* @s: The operator
*
* Return: The function associated to the operator @s
*/
int (*get_op_func(char *s)) (int, int)
{
_op_t ops[] = {
{"+", op_add},
{"-", op_sub},
{"*", op_mul},
{"/", op_div},
{"%", op_mod},
{NULL, NULL}
};
int i;

i = 0;
while (ops[i].op != NULL)
{
if (strcmp(ops[i].op, s) == 0)
{
return (ops[i].f);
}
i++;
}
return (NULL);
}
1 change: 1 addition & 0 deletions tests/doc/doc9.expected.stdout
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
get_op_func
get_op_func

0 comments on commit 3959667

Please sign in to comment.