Sint
Sint

Reputation: 1620

Any tools to refactor c structures under a superstructure?

Are there any tools which help manage plain old c structures?

I have a number of structures that I would like to refactor under one big happy structure.

That is, I currently have:

typedef struct foo_s
{
  //variables
}foo_t;
typedef struct bar_s
{
  //variables
}bar_t;

static foo_t foo;
static bar_t bar;

I would like to use the following:

typedef struct super_s
{
  foo_t foo;
  bar_t bar;
}super_t;
static super_t super;

Now, global replace of "foo" with "super.foo" and "bar" with "super.bar" works, but I have to pay close attention for any naming gotchas.

Is there anything more specialized?

Enviroment: Usually, I work with Eclipse IDE for C/C++ Developers under Linux, but any tool/plugin/script/whatnot under Linux or Windows would be great.

Upvotes: 0

Views: 295

Answers (1)

moliad
moliad

Reputation: 1503

In MSVC (even the express version, which is free) you can search for all code references of a specific token, this should help you out in at least finding more precisely all places where a struct/variable/function is being used, within all project files.

since this search uses the token reference graph, it will in fact filter out things which have the same variable name but aren't the same actual value, which is already a boon.

[EDIT]

I forgot that you must enable this manually, since its set to using "raw textual search" by default...

in the main menu go to: Options -> Text Editor -> C/C++ -> Advanced -> References

and set Disable Resolving to False.

Upvotes: 1

Related Questions