I have a very big C programming project that uses thousands of struct variables with this naming convention:
specificstruct->x = specificstruct->y + specificstruct->z
I want to do some heavy refactoring, namely converting most of these struct members to arrays. The code above would look like this:
specificstruct->x[i] = specificstruct...
I need to know if it's possible to use a tool like ctags or cscope to find all the usages of a function but filter the results depending on the value of one of its parameters.
For example, let's assume we have a function void foo(int a, int b) that is used a thousand times along all the source tree and I need to check if it's being call...
I want to write a semantic patch for coccinelle, so that it will add if (ptr == NULL) ... checks after calls to malloc where they are missing.
Let's say I have the following input source code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// memory leaks ignored
static void OK_simple(void)
{
char *ptr;
ptr = malloc(100...
What is the correct type to use for declaring a metavariable that possibly could match either variables or members in a struct?
Take for instance the following example source code:
#include <stdio.h>
#include <stdlib.h>
struct some_struct {
int i;
char *s;
};
void test(void)
{
struct some_struct *ptr;
...