Use const char *argv[] signatures
C is really weird about this stuff, but this makes more sense to me.weechat-hashes
parent
9bc200bfe5
commit
36ec6cf258
4
chat.h
4
chat.h
|
@ -40,8 +40,8 @@ void selfNick(const char *nick);
|
||||||
void selfUser(const char *user);
|
void selfUser(const char *user);
|
||||||
void selfJoin(const char *join);
|
void selfJoin(const char *join);
|
||||||
|
|
||||||
void eventWait(char *const argv[]);
|
void eventWait(const char *argv[static 2]);
|
||||||
void eventPipe(char *const argv[]);
|
void eventPipe(const char *argv[static 2]);
|
||||||
void eventLoop(int ui, int irc);
|
void eventLoop(int ui, int irc);
|
||||||
|
|
||||||
struct Tag {
|
struct Tag {
|
||||||
|
|
8
event.c
8
event.c
|
@ -33,18 +33,18 @@ static struct {
|
||||||
int fd;
|
int fd;
|
||||||
} spawn;
|
} spawn;
|
||||||
|
|
||||||
void eventWait(char *const argv[]) {
|
void eventWait(const char *argv[static 2]) {
|
||||||
uiHide();
|
uiHide();
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid < 0) err(EX_OSERR, "fork");
|
if (pid < 0) err(EX_OSERR, "fork");
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
execvp(argv[0], argv);
|
execvp(argv[0], (char *const *)argv);
|
||||||
err(EX_CONFIG, "%s", argv[0]);
|
err(EX_CONFIG, "%s", argv[0]);
|
||||||
}
|
}
|
||||||
spawn.wait = true;
|
spawn.wait = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void eventPipe(char *const argv[]) {
|
void eventPipe(const char *argv[static 2]) {
|
||||||
if (spawn.pipe) {
|
if (spawn.pipe) {
|
||||||
uiLog(TagStatus, UIHot, L"event: existing pipe");
|
uiLog(TagStatus, UIHot, L"event: existing pipe");
|
||||||
return;
|
return;
|
||||||
|
@ -62,7 +62,7 @@ void eventPipe(char *const argv[]) {
|
||||||
dup2(rw[1], STDOUT_FILENO);
|
dup2(rw[1], STDOUT_FILENO);
|
||||||
dup2(rw[1], STDERR_FILENO);
|
dup2(rw[1], STDERR_FILENO);
|
||||||
close(rw[1]);
|
close(rw[1]);
|
||||||
execvp(argv[0], argv);
|
execvp(argv[0], (char *const *)argv);
|
||||||
perror(argv[0]);
|
perror(argv[0]);
|
||||||
exit(EX_CONFIG);
|
exit(EX_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
3
input.c
3
input.c
|
@ -144,8 +144,7 @@ static void inputClose(struct Tag tag, char *params) {
|
||||||
static void inputMan(struct Tag tag, char *params) {
|
static void inputMan(struct Tag tag, char *params) {
|
||||||
(void)tag;
|
(void)tag;
|
||||||
(void)params;
|
(void)params;
|
||||||
char *argv[] = { "man", "1", "chatte", NULL };
|
eventWait((const char *[]) { "man", "1", "chatte", NULL });
|
||||||
eventWait(argv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
|
|
4
url.c
4
url.c
|
@ -91,14 +91,14 @@ void urlOpenMatch(struct Tag tag, const char *substr) {
|
||||||
struct Entry entry = ringEntry(i);
|
struct Entry entry = ringEntry(i);
|
||||||
if (!entry.url || entry.tag != tag.id) continue;
|
if (!entry.url || entry.tag != tag.id) continue;
|
||||||
if (!strstr(entry.url, substr)) continue;
|
if (!strstr(entry.url, substr)) continue;
|
||||||
eventPipe((char *[]) { "open", entry.url, NULL });
|
eventPipe((const char *[]) { "open", entry.url, NULL });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void urlOpenRange(struct Tag tag, size_t at, size_t to) {
|
void urlOpenRange(struct Tag tag, size_t at, size_t to) {
|
||||||
size_t argc = 1;
|
size_t argc = 1;
|
||||||
char *argv[2 + RingLen] = { "open" };
|
const char *argv[2 + RingLen] = { "open" };
|
||||||
size_t tagIndex = 0;
|
size_t tagIndex = 0;
|
||||||
for (size_t i = RingLen - 1; i < RingLen; --i) {
|
for (size_t i = RingLen - 1; i < RingLen; --i) {
|
||||||
struct Entry entry = ringEntry(i);
|
struct Entry entry = ringEntry(i);
|
||||||
|
|
Loading…
Reference in New Issue