Skip to content

Commit

Permalink
Ditch useless unions in dird config.
Browse files Browse the repository at this point in the history
In essence they save a maximum of one pointer value which is not worth
the side effect it has for printing a config data. To be able to
determine what data is actual in the union you need an extra variable
describing what is the pointer about so then there is little value left
in using an union.
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent dd9180e commit ed5f1be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/dird/dird_conf.c
Expand Up @@ -1871,6 +1871,9 @@ void free_resource(RES *sres, int type)
if (res->res_job.WriteBootstrap) {
free(res->res_job.WriteBootstrap);
}
if (res->res_job.WriteVerifyList) {
free(res->res_job.WriteVerifyList);
}
if (res->res_job.PluginOptions) {
free(res->res_job.PluginOptions);
}
Expand Down
12 changes: 4 additions & 8 deletions src/dird/dird_conf.h
Expand Up @@ -380,12 +380,10 @@ class JOBRES : public BRSRES {
char *add_prefix; /* add prefix to filename */
char *add_suffix; /* add suffix to filename -- .old */
char *backup_format; /* Format of backup to use for protocols supporting multiple backup formats */
char *RestoreBootstrap; /* Bootstrap file */
char *PluginOptions; /* Options to pass to plugin */
union {
char *WriteBootstrap; /* Where to write bootstrap Job updates */
char *WriteVerifyList; /* List of changed files */
};
char *RestoreBootstrap; /* Bootstrap file */
char *WriteBootstrap; /* Where to write bootstrap Job updates */
char *WriteVerifyList; /* List of changed files */
utime_t MaxRunTime; /* max run time in seconds */
utime_t MaxWaitTime; /* max blocking time in seconds */
utime_t FullMaxRunTime; /* Max Full job run time */
Expand Down Expand Up @@ -414,9 +412,7 @@ class JOBRES : public BRSRES {
POOLRES *diff_pool; /* Pool for Differental backups */
POOLRES *next_pool; /* Next Pool for Copy/Migration Jobs and Virtual backups */
char *selection_pattern;
union {
JOBRES *verify_job; /* Job name to verify */
};
JOBRES *verify_job; /* Job name to verify */
JOBRES *jobdefs; /* Job defaults */
alist *run_cmds; /* Run commands */
alist *RunScripts; /* Run {client} program {after|before} Job */
Expand Down

0 comments on commit ed5f1be

Please sign in to comment.