Fix build warning and other small fixes
Fixes these build warnings:
session.c:621:21: warning: variable 'wm_command_count' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (client_id)
^~~~~~~~~
session.c:680:10: note: uninitialized use occurs here
if ((wm_command_count > 0) && (wm_command))
^~~~~~~~~~~~~~~~
session.c:621:17: note: remove the 'if' if its condition is always false
if (client_id)
^~~~~~~~~~~~~~
session.c:616:17: warning: variable 'wm_command_count' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (xstreq (c->class.res_name, m->res_name)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
session.c:570:21: note: expanded from macro 'xstreq'
#define xstreq(a,b) ((!a && !b) || (a && b && (strcmp(a,b)==0)))
^
session.c:680:10: note: uninitialized use occurs here
if ((wm_command_count > 0) && (wm_command))
^~~~~~~~~~~~~~~~
session.c:616:13: note: remove the 'if' if its condition is always true
if (xstreq (c->class.res_name, m->res_name)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
session.c:619:32: warning: variable 'wm_command_count' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
|| xstreq (c->name, m->wm_name)))
~~~~~~~~^~~~~~~~~~~~~~~~~~~~
session.c:570:37: note: expanded from macro 'xstreq'
#define xstreq(a,b) ((!a && !b) || (a && b && (strcmp(a,b)==0)))
^~~~~~
session.c:680:10: note: uninitialized use occurs here
if ((wm_command_count > 0) && (wm_command))
^~~~~~~~~~~~~~~~
session.c:619:32: note: remove the '&&' if its condition is always true
|| xstreq (c->name, m->wm_name)))
^
session.c:619:32: warning: variable 'wm_command_count' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
|| xstreq (c->name, m->wm_name)))
^~~~~~~
session.c:570:37: note: expanded from macro 'xstreq'
#define xstreq(a,b) ((!a && !b) || (a && b && (strcmp(a,b)==0)))
^
session.c:680:10: note: uninitialized use occurs here
if ((wm_command_count > 0) && (wm_command))
^~~~~~~~~~~~~~~~
session.c:619:32: note: remove the '&&' if its condition is always true
|| xstreq (c->name, m->wm_name)))
^
session.c:616:17: warning: variable 'wm_command_count' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
if (xstreq (c->class.res_name, m->res_name)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
session.c:570:21: note: expanded from macro 'xstreq'
#define xstreq(a,b) ((!a && !b) || (a && b && (strcmp(a,b)==0)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
session.c:680:10: note: uninitialized use occurs here
if ((wm_command_count > 0) && (wm_command))
^~~~~~~~~~~~~~~~
session.c:616:17: note: remove the '&&' if its condition is always true
if (xstreq (c->class.res_name, m->res_name)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
session.c:570:21: note: expanded from macro 'xstreq'
#define xstreq(a,b) ((!a && !b) || (a && b && (strcmp(a,b)==0)))
^
session.c:616:25: warning: variable 'wm_command_count' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
if (xstreq (c->class.res_name, m->res_name)
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
session.c:570:37: note: expanded from macro 'xstreq'
#define xstreq(a,b) ((!a && !b) || (a && b && (strcmp(a,b)==0)))
^~~~~~
session.c:680:10: note: uninitialized use occurs here
if ((wm_command_count > 0) && (wm_command))
^~~~~~~~~~~~~~~~
session.c:616:25: note: remove the '&&' if its condition is always true
if (xstreq (c->class.res_name, m->res_name)
^
session.c:616:25: warning: variable 'wm_command_count' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
if (xstreq (c->class.res_name, m->res_name)
^~~~~~~~~~~~~~~~~
session.c:570:37: note: expanded from macro 'xstreq'
#define xstreq(a,b) ((!a && !b) || (a && b && (strcmp(a,b)==0)))
^
session.c:680:10: note: uninitialized use occurs here
if ((wm_command_count > 0) && (wm_command))
^~~~~~~~~~~~~~~~
session.c:616:25: note: remove the '&&' if its condition is always true
if (xstreq (c->class.res_name, m->res_name)
^
session.c:605:13: warning: variable 'wm_command_count' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if ((window_role) || (m->window_role))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
session.c:680:10: note: uninitialized use occurs here
if ((wm_command_count > 0) && (wm_command))
^~~~~~~~~~~~~~~~
session.c:605:9: note: remove the 'if' if its condition is always false
if ((window_role) || (m->window_role))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
session.c:605:13: warning: variable 'wm_command_count' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
if ((window_role) || (m->window_role))
^~~~~~~~~~~~~
session.c:680:10: note: uninitialized use occurs here
if ((wm_command_count > 0) && (wm_command))
^~~~~~~~~~~~~~~~
session.c:605:13: note: remove the '||' if its condition is always false
if ((window_role) || (m->window_role))
^~~~~~~~~~~~~~~~
session.c:594:9: warning: variable 'wm_command_count' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (xstreq (client_id, m->client_id))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
session.c:570:21: note: expanded from macro 'xstreq'
#define xstreq(a,b) ((!a && !b) || (a && b && (strcmp(a,b)==0)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
session.c:680:10: note: uninitialized use occurs here
if ((wm_command_count > 0) && (wm_command))
^~~~~~~~~~~~~~~~
session.c:594:5: note: remove the 'if' if its condition is always true
if (xstreq (client_id, m->client_id))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
session.c:594:17: warning: variable 'wm_command_count' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
if (xstreq (client_id, m->client_id))
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
session.c:570:37: note: expanded from macro 'xstreq'
#define xstreq(a,b) ((!a && !b) || (a && b && (strcmp(a,b)==0)))
^~~~~~
session.c:680:10: note: uninitialized use occurs here
if ((wm_command_count > 0) && (wm_command))
^~~~~~~~~~~~~~~~
session.c:594:17: note: remove the '&&' if its condition is always true
if (xstreq (client_id, m->client_id))
^
session.c:594:17: warning: variable 'wm_command_count' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
if (xstreq (client_id, m->client_id))
^~~~~~~~~
session.c:570:37: note: expanded from macro 'xstreq'
#define xstreq(a,b) ((!a && !b) || (a && b && (strcmp(a,b)==0)))
^
session.c:680:10: note: uninitialized use occurs here
if ((wm_command_count > 0) && (wm_command))
^~~~~~~~~~~~~~~~
session.c:594:17: note: remove the '&&' if its condition is always true
if (xstreq (client_id, m->client_id))
^
session.c:580:26: note: initialize the variable 'wm_command_count' to silence this warning
gint wm_command_count;
^
= 0
And other small fixes.
Edited by Avinash Sonawane