Xinqi Bao's Git
projects
/
slstatus.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
removing typecasts for pcm_mixer cause more issues than before
[slstatus.git]
/
slstatus.c
diff --git
a/slstatus.c
b/slstatus.c
index
40aaa19
..
60b5bbb
100644
(file)
--- a/
slstatus.c
+++ b/
slstatus.c
@@
-29,7
+29,7
@@
#include "strlcat.h"
#include "strlcpy.h"
#include "strlcat.h"
#include "strlcpy.h"
-typedef char *(*op_fun)
(const char *
);
+typedef char *(*op_fun)
(
);
struct arg {
op_fun func;
const char *format;
struct arg {
op_fun func;
const char *format;
@@
-255,14
+255,8
@@
entropy(void)
static char *
gid(void)
{
static char *
gid(void)
{
- gid_t gid;
-
- if ((gid = getgid()) < 0) {
- fprintf(stderr, "Could no get gid.\n");
- return smprintf(unknowntext);
- } else
- return smprintf("%d", gid);
- return smprintf(unknowntext);
+ gid_t gid = getgid();
+ return smprintf("%d", gid);
}
static char *
}
static char *
@@
-612,7
+606,9
@@
wifi_essid(const char *wificard)
int
main(void)
{
int
main(void)
{
- char status_string[1024];
+ size_t i;
+ char status_string[4096];
+ char *res, *element;
struct arg argument;
if (!(dpy = XOpenDisplay(0x0))) {
struct arg argument;
if (!(dpy = XOpenDisplay(0x0))) {
@@
-622,13
+618,13
@@
main(void)
for (;;) {
memset(status_string, 0, sizeof(status_string));
for (;;) {
memset(status_string, 0, sizeof(status_string));
- for (
size_t
i = 0; i < sizeof(args) / sizeof(args[0]); ++i) {
+ for (i = 0; i < sizeof(args) / sizeof(args[0]); ++i) {
argument = args[i];
if (argument.args == NULL)
argument = args[i];
if (argument.args == NULL)
-
char *
res = argument.func();
+ res = argument.func();
else
else
-
char *
res = argument.func(argument.args);
-
char *
element = smprintf(argument.format, res);
+ res = argument.func(argument.args);
+ element = smprintf(argument.format, res);
if (element == NULL) {
element = smprintf(unknowntext);
fprintf(stderr, "Failed to format output.\n");
if (element == NULL) {
element = smprintf(unknowntext);
fprintf(stderr, "Failed to format output.\n");