summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-03-20 19:08:29 +0100
committerDavid Herrmann <dh.herrmann@googlemail.com>2012-03-20 19:08:29 +0100
commit4790d9f7ab0cc0d36f4c1d2744a849ca633bd874 (patch)
tree94e05a8740c924517de337cfc16bc4d18e0a8335 /tests
parente7e0744e6e1d869a031188d15e67b7862a3c3f0e (diff)
eloop: move prefix to "ev_" instead of "kmscon_"
The long "kmscon_" prefix is horrible so move everything to "ev_" now. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_console.c48
-rw-r--r--tests/test_input.c22
-rw-r--r--tests/test_terminal.c30
-rw-r--r--tests/test_vt.c18
4 files changed, 59 insertions, 59 deletions
diff --git a/tests/test_console.c b/tests/test_console.c
index f10a0c6..eb12beb 100644
--- a/tests/test_console.c
+++ b/tests/test_console.c
@@ -59,22 +59,22 @@
static volatile sig_atomic_t terminate;
struct console {
- struct kmscon_eloop *loop;
- struct kmscon_signal *sig_term;
- struct kmscon_signal *sig_int;
- struct kmscon_fd *stdin_fd;
+ struct ev_eloop *loop;
+ struct ev_signal *sig_term;
+ struct ev_signal *sig_int;
+ struct ev_fd *stdin_fd;
struct kmscon_symbol_table *st;
struct kmscon_font_factory *ff;
struct kmscon_compositor *comp;
struct kmscon_vt *vt;
struct kmscon_console *con;
- struct kmscon_idle *idle;
+ struct ev_idle *idle;
uint32_t max_x;
uint32_t max_y;
};
-static void stdin_cb(struct kmscon_fd *fd, int mask, void *data)
+static void stdin_cb(struct ev_fd *fd, int mask, void *data)
{
struct console *con = data;
char buf[512];
@@ -90,7 +90,7 @@ static void stdin_cb(struct kmscon_fd *fd, int mask, void *data)
log_info("stdin read error: %d\n", errno);
} else if (!ret) {
log_info("stdin closed\n");
- kmscon_eloop_rm_fd(fd);
+ ev_eloop_rm_fd(fd);
con->stdin_fd = NULL;
} else {
len = ret;
@@ -136,11 +136,11 @@ static void map_outputs(struct console *con)
}
}
-static void draw(struct kmscon_idle *idle, void *data)
+static void draw(struct ev_idle *idle, void *data)
{
struct console *con = data;
- kmscon_eloop_rm_idle(idle);
+ ev_eloop_rm_idle(idle);
map_outputs(con);
}
@@ -148,7 +148,7 @@ static void schedule_draw(struct console *con)
{
int ret;
- ret = kmscon_eloop_add_idle(con->loop, con->idle, draw, con);
+ ret = ev_eloop_add_idle(con->loop, con->idle, draw, con);
if (ret && ret != -EALREADY)
log_warn("Cannot schedule draw function\n");
}
@@ -180,7 +180,7 @@ static void activate_outputs(struct console *con)
schedule_draw(con);
}
-static void sig_term(struct kmscon_signal *sig, int signum, void *data)
+static void sig_term(struct ev_signal *sig, int signum, void *data)
{
terminate = 1;
}
@@ -231,39 +231,39 @@ static void print_help(struct console *con)
static void destroy_eloop(struct console *con)
{
- kmscon_eloop_rm_idle(con->idle);
- kmscon_idle_unref(con->idle);
+ ev_eloop_rm_idle(con->idle);
+ ev_idle_unref(con->idle);
kmscon_console_unref(con->con);
kmscon_compositor_unref(con->comp);
kmscon_vt_unref(con->vt);
kmscon_font_factory_unref(con->ff);
kmscon_symbol_table_unref(con->st);
- kmscon_eloop_rm_fd(con->stdin_fd);
- kmscon_eloop_rm_signal(con->sig_int);
- kmscon_eloop_rm_signal(con->sig_term);
- kmscon_eloop_unref(con->loop);
+ ev_eloop_rm_fd(con->stdin_fd);
+ ev_eloop_rm_signal(con->sig_int);
+ ev_eloop_rm_signal(con->sig_term);
+ ev_eloop_unref(con->loop);
}
static int setup_eloop(struct console *con)
{
int ret;
- ret = kmscon_eloop_new(&con->loop);
+ ret = ev_eloop_new(&con->loop);
if (ret)
return ret;
- ret = kmscon_eloop_new_signal(con->loop, &con->sig_term, SIGTERM,
+ ret = ev_eloop_new_signal(con->loop, &con->sig_term, SIGTERM,
sig_term, NULL);
if (ret)
goto err_loop;
- ret = kmscon_eloop_new_signal(con->loop, &con->sig_int, SIGINT,
+ ret = ev_eloop_new_signal(con->loop, &con->sig_int, SIGINT,
sig_term, NULL);
if (ret)
goto err_loop;
- ret = kmscon_eloop_new_fd(con->loop, &con->stdin_fd, 0,
- KMSCON_READABLE, stdin_cb, con);
+ ret = ev_eloop_new_fd(con->loop, &con->stdin_fd, 0,
+ EV_READABLE, stdin_cb, con);
if (ret)
goto err_loop;
@@ -295,7 +295,7 @@ static int setup_eloop(struct console *con)
if (ret)
goto err_loop;
- ret = kmscon_idle_new(&con->idle);
+ ret = ev_idle_new(&con->idle);
if (ret)
goto err_loop;
@@ -326,7 +326,7 @@ int main(int argc, char **argv)
schedule_draw(&con);
while (!terminate) {
- ret = kmscon_eloop_dispatch(con.loop, -1);
+ ret = ev_eloop_dispatch(con.loop, -1);
if (ret)
break;
}
diff --git a/tests/test_input.c b/tests/test_input.c
index a4500b2..f7ceefb 100644
--- a/tests/test_input.c
+++ b/tests/test_input.c
@@ -42,13 +42,13 @@
static bool terminate;
-static void sig_term(struct kmscon_signal *sig, int signum, void *data)
+static void sig_term(struct ev_signal *sig, int signum, void *data)
{
terminate = true;
}
/* Pressing Ctrl-\ should toggle the capturing. */
-static void sig_quit(struct kmscon_signal *sig, int signum, void *data)
+static void sig_quit(struct ev_signal *sig, int signum, void *data)
{
struct kmscon_input *input = data;
@@ -103,9 +103,9 @@ static void input_arrived(struct kmscon_input *input,
int main(int argc, char **argv)
{
int ret;
- struct kmscon_eloop *loop;
+ struct ev_eloop *loop;
struct kmscon_input *input;
- struct kmscon_signal *sigint, *sigquit;
+ struct ev_signal *sigint, *sigquit;
if (!setlocale(LC_ALL, "")) {
log_err("Cannot set locale: %m\n");
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
goto err_out;
}
- ret = kmscon_eloop_new(&loop);
+ ret = ev_eloop_new(&loop);
if (ret) {
log_err("Cannot create eloop\n");
goto err_out;
@@ -125,13 +125,13 @@ int main(int argc, char **argv)
goto err_loop;
}
- ret = kmscon_eloop_new_signal(loop, &sigint, SIGINT, sig_term, NULL);
+ ret = ev_eloop_new_signal(loop, &sigint, SIGINT, sig_term, NULL);
if (ret) {
log_err("Cannot add INT signal\n");
goto err_input;
}
- ret = kmscon_eloop_new_signal(loop, &sigquit, SIGQUIT, sig_quit, input);
+ ret = ev_eloop_new_signal(loop, &sigquit, SIGQUIT, sig_quit, input);
if (ret) {
log_err("Cannot add quit signal\n");
goto err_sigint;
@@ -148,7 +148,7 @@ int main(int argc, char **argv)
system("stty -echo");
while (!terminate) {
- ret = kmscon_eloop_dispatch(loop, -1);
+ ret = ev_eloop_dispatch(loop, -1);
if (ret) {
log_err("Dispatcher failed\n");
break;
@@ -158,13 +158,13 @@ int main(int argc, char **argv)
system("stty echo");
err_sigquit:
- kmscon_eloop_rm_signal(sigquit);
+ ev_eloop_rm_signal(sigquit);
err_sigint:
- kmscon_eloop_rm_signal(sigint);
+ ev_eloop_rm_signal(sigint);
err_input:
kmscon_input_unref(input);
err_loop:
- kmscon_eloop_unref(loop);
+ ev_eloop_unref(loop);
err_out:
return abs(ret);
}
diff --git a/tests/test_terminal.c b/tests/test_terminal.c
index 4a7754a..b6bab90 100644
--- a/tests/test_terminal.c
+++ b/tests/test_terminal.c
@@ -46,10 +46,10 @@
#include "vt.h"
struct app {
- struct kmscon_eloop *eloop;
- struct kmscon_signal *sig_term;
- struct kmscon_signal *sig_int;
- struct kmscon_signal *sig_chld;
+ struct ev_eloop *eloop;
+ struct ev_signal *sig_term;
+ struct ev_signal *sig_int;
+ struct ev_signal *sig_chld;
struct kmscon_symbol_table *st;
struct kmscon_font_factory *ff;
struct kmscon_compositor *comp;
@@ -60,12 +60,12 @@ struct app {
static volatile sig_atomic_t terminate;
-static void sig_term(struct kmscon_signal *sig, int signum, void *data)
+static void sig_term(struct ev_signal *sig, int signum, void *data)
{
terminate = 1;
}
-static void sig_chld(struct kmscon_signal *sig, int signum, void *data)
+static void sig_chld(struct ev_signal *sig, int signum, void *data)
{
pid_t pid;
int status;
@@ -170,31 +170,31 @@ static void destroy_app(struct app *app)
kmscon_compositor_unref(app->comp);
kmscon_font_factory_unref(app->ff);
kmscon_symbol_table_unref(app->st);
- kmscon_eloop_rm_signal(app->sig_chld);
- kmscon_eloop_rm_signal(app->sig_int);
- kmscon_eloop_rm_signal(app->sig_term);
- kmscon_eloop_unref(app->eloop);
+ ev_eloop_rm_signal(app->sig_chld);
+ ev_eloop_rm_signal(app->sig_int);
+ ev_eloop_rm_signal(app->sig_term);
+ ev_eloop_unref(app->eloop);
}
static int setup_app(struct app *app)
{
int ret;
- ret = kmscon_eloop_new(&app->eloop);
+ ret = ev_eloop_new(&app->eloop);
if (ret)
goto err_loop;
- ret = kmscon_eloop_new_signal(app->eloop, &app->sig_term, SIGTERM,
+ ret = ev_eloop_new_signal(app->eloop, &app->sig_term, SIGTERM,
sig_term, NULL);
if (ret)
goto err_loop;
- ret = kmscon_eloop_new_signal(app->eloop, &app->sig_int, SIGINT,
+ ret = ev_eloop_new_signal(app->eloop, &app->sig_int, SIGINT,
sig_term, NULL);
if (ret)
goto err_loop;
- ret = kmscon_eloop_new_signal(app->eloop, &app->sig_chld, SIGCHLD,
+ ret = ev_eloop_new_signal(app->eloop, &app->sig_chld, SIGCHLD,
sig_chld, NULL);
if (ret)
goto err_loop;
@@ -263,7 +263,7 @@ int main(int argc, char **argv)
log_info("test: starting main-loop\n");
while (!terminate) {
- ret = kmscon_eloop_dispatch(app.eloop, -1);
+ ret = ev_eloop_dispatch(app.eloop, -1);
if (ret)
break;
}
diff --git a/tests/test_vt.c b/tests/test_vt.c
index 456c978..5a12c27 100644
--- a/tests/test_vt.c
+++ b/tests/test_vt.c
@@ -46,7 +46,7 @@
static bool terminate;
-static void sig_term(struct kmscon_signal *sig, int signum, void *data)
+static void sig_term(struct ev_signal *sig, int signum, void *data)
{
terminate = true;
}
@@ -54,17 +54,17 @@ static void sig_term(struct kmscon_signal *sig, int signum, void *data)
int main(int argc, char **argv)
{
int ret;
- struct kmscon_eloop *loop;
+ struct ev_eloop *loop;
struct kmscon_vt *vt;
- struct kmscon_signal *sig;
+ struct ev_signal *sig;
- ret = kmscon_eloop_new(&loop);
+ ret = ev_eloop_new(&loop);
if (ret) {
log_err("Cannot create eloop\n");
goto err_out;
}
- ret = kmscon_eloop_new_signal(loop, &sig, SIGINT, sig_term, NULL);
+ ret = ev_eloop_new_signal(loop, &sig, SIGINT, sig_term, NULL);
if (ret) {
log_err("Cannot add signal\n");
goto err_loop;
@@ -87,7 +87,7 @@ int main(int argc, char **argv)
log_warn("Cannot switch to VT\n");
while (!terminate) {
- ret = kmscon_eloop_dispatch(loop, -1);
+ ret = ev_eloop_dispatch(loop, -1);
if (ret) {
log_err("Dispatcher failed\n");
break;
@@ -99,14 +99,14 @@ int main(int argc, char **argv)
/* switch back to previous VT but wait for eloop to process SIGUSR0 */
ret = kmscon_vt_leave(vt);
if (ret == -EINPROGRESS)
- kmscon_eloop_dispatch(loop, 1000);
+ ev_eloop_dispatch(loop, 1000);
err_vt:
kmscon_vt_unref(vt);
err_sig:
- kmscon_eloop_rm_signal(sig);
+ ev_eloop_rm_signal(sig);
err_loop:
- kmscon_eloop_unref(loop);
+ ev_eloop_unref(loop);
err_out:
return abs(ret);
}