mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Remove some unnecessary variable initializations
Not really bugs, just wasted. They clutter up the output of static analysis with cppcheck. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3ab27e65e8
commit
3f261f56f3
4 changed files with 9 additions and 11 deletions
|
@ -1173,7 +1173,7 @@ static void cell_edited_cb(GtkCellRendererText *cell, gchar *path,
|
||||||
holdnicknames->nickname = strdup(new_text);
|
holdnicknames->nickname = strdup(new_text);
|
||||||
holdnicknames->next = NULL;
|
holdnicknames->next = NULL;
|
||||||
} else {
|
} else {
|
||||||
struct device_info * top = NULL;
|
struct device_info * top;
|
||||||
struct device_info * last = holdnicknames;
|
struct device_info * last = holdnicknames;
|
||||||
top = (struct device_info *) malloc(sizeof( struct device_info ));
|
top = (struct device_info *) malloc(sizeof( struct device_info ));
|
||||||
top->model = strdup(model);
|
top->model = strdup(model);
|
||||||
|
|
|
@ -169,7 +169,7 @@ static void divedate(char *buffer, void *_when)
|
||||||
{
|
{
|
||||||
int d,m,y;
|
int d,m,y;
|
||||||
timestamp_t *when = _when;
|
timestamp_t *when = _when;
|
||||||
int success = 0;
|
int success;
|
||||||
|
|
||||||
success = cur_tm.tm_sec | cur_tm.tm_min | cur_tm.tm_hour;
|
success = cur_tm.tm_sec | cur_tm.tm_min | cur_tm.tm_hour;
|
||||||
if (sscanf(buffer, "%d.%d.%d", &d, &m, &y) == 3) {
|
if (sscanf(buffer, "%d.%d.%d", &d, &m, &y) == 3) {
|
||||||
|
|
10
profile.c
10
profile.c
|
@ -391,14 +391,14 @@ static void plot_one_event(struct graphics_context *gc, struct plot_info *pi, st
|
||||||
unsigned int he = event->value >> 16;
|
unsigned int he = event->value >> 16;
|
||||||
unsigned int o2 = event->value & 0xffff;
|
unsigned int o2 = event->value & 0xffff;
|
||||||
if (he) {
|
if (he) {
|
||||||
snprintf(buffer, sizeof(buffer), "%s: (%d/%d)",
|
snprintf(buffer, sizeof(buffer), "%s: (%u/%u)",
|
||||||
_(event->name), o2, he);
|
_(event->name), o2, he);
|
||||||
} else {
|
} else {
|
||||||
if (o2 == 21)
|
if (o2 == 21)
|
||||||
snprintf(buffer, sizeof(buffer), "%s: %s",
|
snprintf(buffer, sizeof(buffer), "%s: %s",
|
||||||
_(event->name), _("air"));
|
_(event->name), _("air"));
|
||||||
else
|
else
|
||||||
snprintf(buffer, sizeof(buffer), "%s: %d%% %s",
|
snprintf(buffer, sizeof(buffer), "%s: %u%% %s",
|
||||||
_(event->name), o2, _("O" UTF8_SUBSCRIPT_2));
|
_(event->name), o2, _("O" UTF8_SUBSCRIPT_2));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1516,10 +1516,10 @@ static void check_gas_change_events(struct dive *dive, struct divecomputer *dc,
|
||||||
static void calculate_max_limits(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc)
|
static void calculate_max_limits(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc)
|
||||||
{
|
{
|
||||||
struct plot_info *pi;
|
struct plot_info *pi;
|
||||||
int maxdepth = 0;
|
int maxdepth;
|
||||||
int maxtime = 0;
|
int maxtime = 0;
|
||||||
int maxpressure = 0, minpressure = INT_MAX;
|
int maxpressure = 0, minpressure = INT_MAX;
|
||||||
int mintemp = 0, maxtemp = 0;
|
int mintemp, maxtemp;
|
||||||
int cyl;
|
int cyl;
|
||||||
|
|
||||||
/* The plot-info is embedded in the graphics context */
|
/* The plot-info is embedded in the graphics context */
|
||||||
|
@ -1751,8 +1751,6 @@ static void populate_pressure_information(struct dive *dive, struct divecomputer
|
||||||
for (i = 1; i < pi->nr; i++) {
|
for (i = 1; i < pi->nr; i++) {
|
||||||
struct plot_data *entry = pi->entry + i;
|
struct plot_data *entry = pi->entry + i;
|
||||||
|
|
||||||
entry = pi->entry + i;
|
|
||||||
|
|
||||||
/* discrete integration of pressure over time to get the SAC rate equivalent */
|
/* discrete integration of pressure over time to get the SAC rate equivalent */
|
||||||
current->pressure_time += pressure_time(dive, entry-1, entry);
|
current->pressure_time += pressure_time(dive, entry-1, entry);
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ void subsurface_set_conf(char *name, const char *value)
|
||||||
* to pass the boolean value), the other one passes value (the
|
* to pass the boolean value), the other one passes value (the
|
||||||
* address of the string. */
|
* address of the string. */
|
||||||
int wlen;
|
int wlen;
|
||||||
wchar_t *wname = NULL, *wstring = NULL;
|
wchar_t *wname, *wstring;
|
||||||
|
|
||||||
wname = (wchar_t *)g_utf8_to_utf16(name, -1, NULL, NULL, NULL);
|
wname = (wchar_t *)g_utf8_to_utf16(name, -1, NULL, NULL, NULL);
|
||||||
if (!wname)
|
if (!wname)
|
||||||
|
@ -73,7 +73,7 @@ void subsurface_set_conf(char *name, const char *value)
|
||||||
|
|
||||||
void subsurface_set_conf_bool(char *name, int value)
|
void subsurface_set_conf_bool(char *name, int value)
|
||||||
{
|
{
|
||||||
wchar_t *wname = NULL;
|
wchar_t *wname;
|
||||||
|
|
||||||
wname = (wchar_t *)g_utf8_to_utf16(name, -1, NULL, NULL, NULL);
|
wname = (wchar_t *)g_utf8_to_utf16(name, -1, NULL, NULL, NULL);
|
||||||
if (!wname)
|
if (!wname)
|
||||||
|
@ -89,7 +89,7 @@ const void *subsurface_get_conf(char *name)
|
||||||
const int csize = 64;
|
const int csize = 64;
|
||||||
int blen = 0;
|
int blen = 0;
|
||||||
LONG ret = ERROR_MORE_DATA;
|
LONG ret = ERROR_MORE_DATA;
|
||||||
wchar_t *wstring = NULL, *wname = NULL;
|
wchar_t *wstring = NULL, *wname;
|
||||||
char *utf8_string;
|
char *utf8_string;
|
||||||
|
|
||||||
wname = (wchar_t *)g_utf8_to_utf16(name, -1, NULL, NULL, NULL);
|
wname = (wchar_t *)g_utf8_to_utf16(name, -1, NULL, NULL, NULL);
|
||||||
|
|
Loading…
Add table
Reference in a new issue