[systemd-commits] 6 commits - Makefile.am src/libsystemd-terminal src/shared

David Herrmann dvdhrm at kemper.freedesktop.org
Wed Oct 1 23:44:17 PDT 2014


 Makefile.am                                |    8 -
 src/libsystemd-terminal/term-internal.h    |  132 -------------------------
 src/libsystemd-terminal/term-screen.c      |   12 ++
 src/libsystemd-terminal/term.h             |  149 +++++++++++++++++++++++++++++
 src/libsystemd-terminal/test-unifont.c     |    2 
 src/libsystemd-terminal/unifont-def.h      |    2 
 src/libsystemd-terminal/unifont-internal.h |   54 ----------
 src/libsystemd-terminal/unifont.c          |   14 ++
 src/libsystemd-terminal/unifont.h          |   56 ++++++++++
 src/shared/barrier.c                       |   19 ++-
 src/shared/barrier.h                       |    2 
 11 files changed, 253 insertions(+), 197 deletions(-)

New commits:
commit fc808616227115ccab8c04f00f8f7472c7353ae5
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Thu Oct 2 08:31:28 2014 +0200

    barrier: fix up constructor error handling
    
    We cannot rely on "errno" to be non-zero on failure, if we perform
    multiple glibc calls. That is, if the first eventfd() call fails, but the
    second succeeds, we cleanup the barrier but return 0.
    
    Fix this by always testing the return value immediately. This should also
    fix all the coverity warnings.

diff --git a/src/shared/barrier.c b/src/shared/barrier.c
index 4a5544d..f65363a 100644
--- a/src/shared/barrier.c
+++ b/src/shared/barrier.c
@@ -112,15 +112,24 @@
  * Returns: 0 on success, negative error code on failure.
  */
 int barrier_create(Barrier *b) {
+        _cleanup_(barrier_destroyp) Barrier *staging = b;
+        int r;
+
         assert(b);
 
-        if ((b->me = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK)) < 0 ||
-            (b->them = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK)) < 0 ||
-            pipe2(b->pipe, O_CLOEXEC | O_NONBLOCK) < 0) {
-                barrier_destroy(b);
+        b->me = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
+        if (b->me < 0)
+                return -errno;
+
+        b->them = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
+        if (b->them < 0)
+                return -errno;
+
+        r = pipe2(b->pipe, O_CLOEXEC | O_NONBLOCK);
+        if (r < 0)
                 return -errno;
-        }
 
+        staging = NULL;
         return 0;
 }
 
diff --git a/src/shared/barrier.h b/src/shared/barrier.h
index 53b4439..c55e311 100644
--- a/src/shared/barrier.h
+++ b/src/shared/barrier.h
@@ -62,6 +62,8 @@ struct Barrier {
 int barrier_create(Barrier *obj);
 void barrier_destroy(Barrier *b);
 
+DEFINE_TRIVIAL_CLEANUP_FUNC(Barrier*, barrier_destroy);
+
 void barrier_set_role(Barrier *b, unsigned int role);
 
 bool barrier_place(Barrier *b);

commit dda57d9143644d39091207b287f142f91f55d0ad
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Wed Oct 1 11:29:09 2014 +0200

    terminal: add helpers to retrieve page dimensions
    
    Allow term users to retrieve the page dimensions of a terminal screen.
    This is needed to properly calculate the grid dimensions when rendering.

diff --git a/src/libsystemd-terminal/term-screen.c b/src/libsystemd-terminal/term-screen.c
index 67f9056..14c32ac 100644
--- a/src/libsystemd-terminal/term-screen.c
+++ b/src/libsystemd-terminal/term-screen.c
@@ -3743,6 +3743,18 @@ static int screen_feed_cmd(term_screen *screen, const term_seq *seq) {
         return 0;
 }
 
+unsigned int term_screen_get_width(term_screen *screen) {
+        assert_return(screen, -EINVAL);
+
+        return screen->page->width;
+}
+
+unsigned int term_screen_get_height(term_screen *screen) {
+        assert_return(screen, -EINVAL);
+
+        return screen->page->height;
+}
+
 int term_screen_feed_text(term_screen *screen, const uint8_t *in, size_t size) {
         const uint32_t *ucs4_str;
         size_t i, j, ucs4_len;
diff --git a/src/libsystemd-terminal/term.h b/src/libsystemd-terminal/term.h
index 2f2bb47..021cf1c 100644
--- a/src/libsystemd-terminal/term.h
+++ b/src/libsystemd-terminal/term.h
@@ -137,6 +137,9 @@ term_screen *term_screen_unref(term_screen *screen);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(term_screen*, term_screen_unref);
 
+unsigned int term_screen_get_width(term_screen *screen);
+unsigned int term_screen_get_height(term_screen *screen);
+
 int term_screen_feed_text(term_screen *screen, const uint8_t *in, size_t size);
 int term_screen_feed_keyboard(term_screen *screen, uint32_t keysym, uint32_t ascii, uint32_t ucs4, unsigned int mods);
 int term_screen_resize(term_screen *screen, unsigned int width, unsigned int height);

commit a30f1425133d2b64a1c3f0113a710528872a3cbb
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Wed Oct 1 11:27:46 2014 +0200

    terminal: add term.h header for library users
    
    Like all the other parts of libsystemd-terminal, split API of
    term-internal.h into term.h so we can use it from systemd-consoled.

diff --git a/Makefile.am b/Makefile.am
index 5fa4e4a..5033028 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3051,6 +3051,7 @@ libsystemd_terminal_la_SOURCES = \
 	src/libsystemd-terminal/sysview.h \
 	src/libsystemd-terminal/sysview-internal.h \
 	src/libsystemd-terminal/sysview.c \
+	src/libsystemd-terminal/term.h \
 	src/libsystemd-terminal/term-internal.h \
 	src/libsystemd-terminal/term-charset.c \
 	src/libsystemd-terminal/term-page.c \
diff --git a/src/libsystemd-terminal/term-internal.h b/src/libsystemd-terminal/term-internal.h
index 345996b..f0f4432 100644
--- a/src/libsystemd-terminal/term-internal.h
+++ b/src/libsystemd-terminal/term-internal.h
@@ -24,26 +24,20 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdlib.h>
+#include "term.h"
 #include "util.h"
 
 typedef struct term_char term_char_t;
 typedef struct term_charbuf term_charbuf_t;
 
-typedef struct term_color term_color;
-typedef struct term_attr term_attr;
 typedef struct term_cell term_cell;
 typedef struct term_line term_line;
 
 typedef struct term_page term_page;
 typedef struct term_history term_history;
 
-typedef struct term_utf8 term_utf8;
-typedef struct term_seq term_seq;
-typedef struct term_parser term_parser;
 typedef uint32_t term_charset[96];
 
-typedef struct term_screen term_screen;
-
 /*
  * Miscellaneous
  * Sundry things and external helpers.
@@ -55,24 +49,6 @@ int mk_wcswidth(const wchar_t *str, size_t len);
 int mk_wcswidth_cjk(const wchar_t *str, size_t len);
 
 /*
- * Ageing
- * Redrawing terminals is quite expensive. Therefore, we avoid redrawing on
- * each single modification and mark modified cells instead. This way, we know
- * which cells to redraw on the next frame. However, a single DIRTY flag is not
- * enough for double/triple buffered screens, hence, we use an AGE field for
- * each cell. If the cell is modified, we simply increase the age by one. Each
- * framebuffer can then remember its last rendered age and request an update of
- * all newer cells.
- * TERM_AGE_NULL is special. If used as cell age, the cell must always be
- * redrawn (forced update). If used as framebuffer age, all cells are drawn.
- * This way, we can allow integer wrap-arounds.
- */
-
-typedef uint64_t term_age_t;
-
-#define TERM_AGE_NULL 0
-
-/*
  * Characters
  * Each cell in a terminal page contains only a single character. This is
  * usually a single UCS-4 value. However, Unicode allows combining-characters,
@@ -143,68 +119,6 @@ static inline void term_char_freep(term_char_t *p) {
 }
 
 /*
- * Attributes
- * Each cell in a terminal page can have its own set of attributes. These alter
- * the behavior of the renderer for this single cell. We use term_attr to
- * specify attributes.
- * The only non-obvious field is "ccode" for foreground and background colors.
- * This field contains the terminal color-code in case no full RGB information
- * was given by the host. It is also required for dynamic color palettes. If it
- * is set to TERM_CCODE_RGB, the "red", "green" and "blue" fields contain the
- * full RGB color.
- */
-
-enum {
-        /* special color-codes */
-        TERM_CCODE_DEFAULT,                                             /* default foreground/background color */
-        TERM_CCODE_256,                                                 /* 256color code */
-        TERM_CCODE_RGB,                                                 /* color is specified as RGB */
-
-        /* dark color-codes */
-        TERM_CCODE_BLACK,
-        TERM_CCODE_RED,
-        TERM_CCODE_GREEN,
-        TERM_CCODE_YELLOW,
-        TERM_CCODE_BLUE,
-        TERM_CCODE_MAGENTA,
-        TERM_CCODE_CYAN,
-        TERM_CCODE_WHITE,                                               /* technically: light grey */
-
-        /* light color-codes */
-        TERM_CCODE_LIGHT_BLACK          = TERM_CCODE_BLACK + 8,         /* technically: dark grey */
-        TERM_CCODE_LIGHT_RED            = TERM_CCODE_RED + 8,
-        TERM_CCODE_LIGHT_GREEN          = TERM_CCODE_GREEN + 8,
-        TERM_CCODE_LIGHT_YELLOW         = TERM_CCODE_YELLOW + 8,
-        TERM_CCODE_LIGHT_BLUE           = TERM_CCODE_BLUE + 8,
-        TERM_CCODE_LIGHT_MAGENTA        = TERM_CCODE_MAGENTA + 8,
-        TERM_CCODE_LIGHT_CYAN           = TERM_CCODE_CYAN + 8,
-        TERM_CCODE_LIGHT_WHITE          = TERM_CCODE_WHITE + 8,
-
-        TERM_CCODE_CNT,
-};
-
-struct term_color {
-        uint8_t ccode;
-        uint8_t c256;
-        uint8_t red;
-        uint8_t green;
-        uint8_t blue;
-};
-
-struct term_attr {
-        term_color fg;                          /* foreground color */
-        term_color bg;                          /* background color */
-
-        unsigned int bold : 1;                  /* bold font */
-        unsigned int italic : 1;                /* italic font */
-        unsigned int underline : 1;             /* underline text */
-        unsigned int inverse : 1;               /* inverse fg/bg */
-        unsigned int protect : 1;               /* protect from erase */
-        unsigned int blink : 1;                 /* blink text */
-        unsigned int hidden : 1;                /* hidden */
-};
-
-/*
  * Cells
  * The term_cell structure respresents a single cell in a terminal page. It
  * contains the stored character, the age of the cell and all its attributes.
@@ -344,26 +258,6 @@ term_line *term_history_pop(term_history *history, unsigned int reserve_width, c
 unsigned int term_history_peek(term_history *history, unsigned int max, unsigned int reserve_width, const term_attr *attr, term_age_t age);
 
 /*
- * UTF-8
- * The UTF-decoder and encoder are adjusted for terminals and provide proper
- * fallbacks for invalid UTF-8. In terminals it's quite usual to use fallbacks
- * instead of rejecting invalid input. This way, old legacy applications still
- * work (this is especially important for 7bit/ASCII DEC modes).
- */
-
-struct term_utf8 {
-        uint32_t chars[5];
-        uint32_t ucs4;
-
-        unsigned int i_bytes : 3;
-        unsigned int n_bytes : 3;
-        unsigned int valid : 1;
-};
-
-size_t term_utf8_encode(char *out_utf8, uint32_t g);
-const uint32_t *term_utf8_decode(term_utf8 *p, size_t *out_len, char c);
-
-/*
  * Parsers
  * The term_parser object parses control-sequences for both host and terminal
  * side. Based on this parser, there is a set of command-parsers that take a
@@ -680,13 +574,6 @@ struct term_parser {
         bool is_host : 1;
 };
 
-int term_parser_new(term_parser **out, bool host);
-term_parser *term_parser_free(term_parser *parser);
-int term_parser_feed(term_parser *parser, const term_seq **seq_out, uint32_t raw);
-
-#define _term_parser_free_ _cleanup_(term_parser_freep)
-DEFINE_TRIVIAL_CLEANUP_FUNC(term_parser*, term_parser_free);
-
 /*
  * Screens
  * A term_screen object represents the terminal-side of the communication. It
@@ -713,9 +600,6 @@ enum {
         TERM_CONFORMANCE_LEVEL_CNT,
 };
 
-typedef int (*term_screen_write_fn) (term_screen *screen, void *userdata, const void *buf, size_t size);
-typedef int (*term_screen_cmd_fn) (term_screen *screen, void *userdata, unsigned int cmd, const term_seq *seq);
-
 struct term_screen {
         unsigned long ref;
         term_age_t age;
@@ -766,17 +650,3 @@ struct term_screen {
                 unsigned int flags;
         } saved;
 };
-
-int term_screen_new(term_screen **out, term_screen_write_fn write_fn, void *write_fn_data, term_screen_cmd_fn cmd_fn, void *cmd_fn_data);
-term_screen *term_screen_ref(term_screen *screen);
-term_screen *term_screen_unref(term_screen *screen);
-
-DEFINE_TRIVIAL_CLEANUP_FUNC(term_screen*, term_screen_unref);
-
-int term_screen_feed_text(term_screen *screen, const uint8_t *in, size_t size);
-int term_screen_feed_keyboard(term_screen *screen, uint32_t keysym, uint32_t ascii, uint32_t ucs4, unsigned int mods);
-int term_screen_resize(term_screen *screen, unsigned int width, unsigned int height);
-void term_screen_soft_reset(term_screen *screen);
-void term_screen_hard_reset(term_screen *screen);
-
-int term_screen_set_answerback(term_screen *screen, const char *answerback);
diff --git a/src/libsystemd-terminal/term.h b/src/libsystemd-terminal/term.h
new file mode 100644
index 0000000..2f2bb47
--- /dev/null
+++ b/src/libsystemd-terminal/term.h
@@ -0,0 +1,146 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+  This file is part of systemd.
+
+  Copyright (C) 2014 David Herrmann <dh.herrmann at gmail.com>
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#pragma once
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include "util.h"
+
+typedef struct term_color term_color;
+typedef struct term_attr term_attr;
+
+typedef struct term_utf8 term_utf8;
+typedef struct term_seq term_seq;
+typedef struct term_parser term_parser;
+
+typedef struct term_screen term_screen;
+
+/*
+ * Ageing
+ */
+
+typedef uint64_t term_age_t;
+
+#define TERM_AGE_NULL 0
+
+/*
+ * Attributes
+ */
+
+enum {
+        /* special color-codes */
+        TERM_CCODE_DEFAULT,                                             /* default foreground/background color */
+        TERM_CCODE_256,                                                 /* 256color code */
+        TERM_CCODE_RGB,                                                 /* color is specified as RGB */
+
+        /* dark color-codes */
+        TERM_CCODE_BLACK,
+        TERM_CCODE_RED,
+        TERM_CCODE_GREEN,
+        TERM_CCODE_YELLOW,
+        TERM_CCODE_BLUE,
+        TERM_CCODE_MAGENTA,
+        TERM_CCODE_CYAN,
+        TERM_CCODE_WHITE,                                               /* technically: light grey */
+
+        /* light color-codes */
+        TERM_CCODE_LIGHT_BLACK          = TERM_CCODE_BLACK + 8,         /* technically: dark grey */
+        TERM_CCODE_LIGHT_RED            = TERM_CCODE_RED + 8,
+        TERM_CCODE_LIGHT_GREEN          = TERM_CCODE_GREEN + 8,
+        TERM_CCODE_LIGHT_YELLOW         = TERM_CCODE_YELLOW + 8,
+        TERM_CCODE_LIGHT_BLUE           = TERM_CCODE_BLUE + 8,
+        TERM_CCODE_LIGHT_MAGENTA        = TERM_CCODE_MAGENTA + 8,
+        TERM_CCODE_LIGHT_CYAN           = TERM_CCODE_CYAN + 8,
+        TERM_CCODE_LIGHT_WHITE          = TERM_CCODE_WHITE + 8,
+
+        TERM_CCODE_CNT,
+};
+
+struct term_color {
+        uint8_t ccode;
+        uint8_t c256;
+        uint8_t red;
+        uint8_t green;
+        uint8_t blue;
+};
+
+struct term_attr {
+        term_color fg;                          /* foreground color */
+        term_color bg;                          /* background color */
+
+        unsigned int bold : 1;                  /* bold font */
+        unsigned int italic : 1;                /* italic font */
+        unsigned int underline : 1;             /* underline text */
+        unsigned int inverse : 1;               /* inverse fg/bg */
+        unsigned int protect : 1;               /* protect from erase */
+        unsigned int blink : 1;                 /* blink text */
+        unsigned int hidden : 1;                /* hidden */
+};
+
+/*
+ * UTF-8
+ */
+
+struct term_utf8 {
+        uint32_t chars[5];
+        uint32_t ucs4;
+
+        unsigned int i_bytes : 3;
+        unsigned int n_bytes : 3;
+        unsigned int valid : 1;
+};
+
+size_t term_utf8_encode(char *out_utf8, uint32_t g);
+const uint32_t *term_utf8_decode(term_utf8 *p, size_t *out_len, char c);
+
+/*
+ * Parsers
+ */
+
+int term_parser_new(term_parser **out, bool host);
+term_parser *term_parser_free(term_parser *parser);
+int term_parser_feed(term_parser *parser, const term_seq **seq_out, uint32_t raw);
+
+#define _term_parser_free_ _cleanup_(term_parser_freep)
+DEFINE_TRIVIAL_CLEANUP_FUNC(term_parser*, term_parser_free);
+
+/*
+ * Screens
+ */
+
+typedef int (*term_screen_write_fn) (term_screen *screen, void *userdata, const void *buf, size_t size);
+typedef int (*term_screen_cmd_fn) (term_screen *screen, void *userdata, unsigned int cmd, const term_seq *seq);
+
+int term_screen_new(term_screen **out, term_screen_write_fn write_fn, void *write_fn_data, term_screen_cmd_fn cmd_fn, void *cmd_fn_data);
+term_screen *term_screen_ref(term_screen *screen);
+term_screen *term_screen_unref(term_screen *screen);
+
+DEFINE_TRIVIAL_CLEANUP_FUNC(term_screen*, term_screen_unref);
+
+int term_screen_feed_text(term_screen *screen, const uint8_t *in, size_t size);
+int term_screen_feed_keyboard(term_screen *screen, uint32_t keysym, uint32_t ascii, uint32_t ucs4, unsigned int mods);
+int term_screen_resize(term_screen *screen, unsigned int width, unsigned int height);
+void term_screen_soft_reset(term_screen *screen);
+void term_screen_hard_reset(term_screen *screen);
+
+int term_screen_set_answerback(term_screen *screen, const char *answerback);

commit 056e86ee7fdae86d358aa068303845dff2cbb598
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Wed Oct 1 11:25:27 2014 +0200

    terminal: move unifont-map to datadir
    
    Lets avoid putting stuff into /usr/shared/unifont/, but keep it in
    /usr/share/systemd/. Upstream lacks interest in this, so don't bother for
    now.

diff --git a/Makefile.am b/Makefile.am
index da36a8c..5fa4e4a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3025,9 +3025,7 @@ noinst_PROGRAMS += \
 	systemd-modeset \
 	systemd-subterm
 
-unifontdatadir=$(datadir)/unifont
-
-dist_unifontdata_DATA = \
+dist_pkgdata_DATA += \
 	src/libsystemd-terminal/unifont-glyph-array.bin
 
 tests += \
diff --git a/src/libsystemd-terminal/unifont-def.h b/src/libsystemd-terminal/unifont-def.h
index 7a0d485..2b0b859 100644
--- a/src/libsystemd-terminal/unifont-def.h
+++ b/src/libsystemd-terminal/unifont-def.h
@@ -115,7 +115,7 @@ typedef struct unifont_glyph_header unifont_glyph_header;
  */
 
 /* path to binary file */
-#define UNIFONT_PATH "/usr/share/unifont/unifont-glyph-array.bin"
+#define UNIFONT_PATH "/usr/share/systemd/unifont-glyph-array.bin"
 
 /* header-size of version 1 */
 #define UNIFONT_HEADER_SIZE_MIN 32

commit fa9653457302c106f8d47060ef3dda2b4c8038a8
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Wed Oct 1 11:24:08 2014 +0200

    terminal: add unifont_get_width/height()
    
    Allow unifont users to retrieve the width and height of unifont glyphs. In
    version 1 this is hard-coded as 8/16, but may be changed in the future.

diff --git a/src/libsystemd-terminal/unifont.c b/src/libsystemd-terminal/unifont.c
index aa91794..7520015 100644
--- a/src/libsystemd-terminal/unifont.c
+++ b/src/libsystemd-terminal/unifont.c
@@ -181,6 +181,18 @@ unifont *unifont_unref(unifont *u) {
         return NULL;
 }
 
+unsigned int unifont_get_width(unifont *u) {
+        assert(u);
+
+        return 8U;
+}
+
+unsigned int unifont_get_height(unifont *u) {
+        assert(u);
+
+        return 16U;
+}
+
 unsigned int unifont_get_stride(unifont *u) {
         assert(u);
 
diff --git a/src/libsystemd-terminal/unifont.h b/src/libsystemd-terminal/unifont.h
index c39512d..0ded614 100644
--- a/src/libsystemd-terminal/unifont.h
+++ b/src/libsystemd-terminal/unifont.h
@@ -50,5 +50,7 @@ unifont *unifont_unref(unifont *u);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(unifont*, unifont_unref);
 
+unsigned int unifont_get_width(unifont *u);
+unsigned int unifont_get_height(unifont *u);
 unsigned int unifont_get_stride(unifont *u);
 int unifont_lookup(unifont *u, unifont_glyph *out, uint32_t ucs4);

commit c2977e5cb874e696994bcb93b8148f52c315b901
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Wed Oct 1 11:23:02 2014 +0200

    terminal: move unifont-internal.h to unifont.h
    
    All the definitions are for outside users, so drop the -internal suffix.
    Internal definitions are in unifont-def.h and unifont.c, no need to share
    those.

diff --git a/Makefile.am b/Makefile.am
index 9e087bd..da36a8c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3059,7 +3059,8 @@ libsystemd_terminal_la_SOURCES = \
 	src/libsystemd-terminal/term-parser.c \
 	src/libsystemd-terminal/term-screen.c \
 	src/libsystemd-terminal/term-wcwidth.c \
-	src/libsystemd-terminal/unifont-internal.h \
+	src/libsystemd-terminal/unifont.h \
+	src/libsystemd-terminal/unifont-def.h \
 	src/libsystemd-terminal/unifont.c
 
 libsystemd_terminal_la_LIBADD = \
diff --git a/src/libsystemd-terminal/test-unifont.c b/src/libsystemd-terminal/test-unifont.c
index 2c41594..cfeef61 100644
--- a/src/libsystemd-terminal/test-unifont.c
+++ b/src/libsystemd-terminal/test-unifont.c
@@ -30,7 +30,7 @@
 #include <string.h>
 #include "macro.h"
 #include "unifont-def.h"
-#include "unifont-internal.h"
+#include "unifont.h"
 #include "util.h"
 
 static void render(char *w, const unifont_glyph *g) {
diff --git a/src/libsystemd-terminal/unifont-internal.h b/src/libsystemd-terminal/unifont-internal.h
deleted file mode 100644
index c39512d..0000000
--- a/src/libsystemd-terminal/unifont-internal.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
-  This file is part of systemd.
-
-  Copyright (C) 2014 David Herrmann <dh.herrmann at gmail.com>
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#pragma once
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include "util.h"
-
-typedef struct unifont unifont;
-typedef struct unifont_glyph unifont_glyph;
-
-/*
- * Unifont
- * The unifont API provides a glyph-lookup for bitmap fonts which can be used
- * as fallback if no system-font is available or if you don't want to deal with
- * full font renderers.
- */
-
-struct unifont_glyph {
-        unsigned int width;
-        unsigned int height;
-        unsigned int stride;
-        unsigned int cwidth;
-        const void *data;       /* unaligned! */
-};
-
-int unifont_new(unifont **out);
-unifont *unifont_ref(unifont *u);
-unifont *unifont_unref(unifont *u);
-
-DEFINE_TRIVIAL_CLEANUP_FUNC(unifont*, unifont_unref);
-
-unsigned int unifont_get_stride(unifont *u);
-int unifont_lookup(unifont *u, unifont_glyph *out, uint32_t ucs4);
diff --git a/src/libsystemd-terminal/unifont.c b/src/libsystemd-terminal/unifont.c
index 9e0f718..aa91794 100644
--- a/src/libsystemd-terminal/unifont.c
+++ b/src/libsystemd-terminal/unifont.c
@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include "macro.h"
 #include "unifont-def.h"
-#include "unifont-internal.h"
+#include "unifont.h"
 #include "util.h"
 
 struct unifont {
diff --git a/src/libsystemd-terminal/unifont.h b/src/libsystemd-terminal/unifont.h
new file mode 100644
index 0000000..c39512d
--- /dev/null
+++ b/src/libsystemd-terminal/unifont.h
@@ -0,0 +1,54 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+  This file is part of systemd.
+
+  Copyright (C) 2014 David Herrmann <dh.herrmann at gmail.com>
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#pragma once
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include "util.h"
+
+typedef struct unifont unifont;
+typedef struct unifont_glyph unifont_glyph;
+
+/*
+ * Unifont
+ * The unifont API provides a glyph-lookup for bitmap fonts which can be used
+ * as fallback if no system-font is available or if you don't want to deal with
+ * full font renderers.
+ */
+
+struct unifont_glyph {
+        unsigned int width;
+        unsigned int height;
+        unsigned int stride;
+        unsigned int cwidth;
+        const void *data;       /* unaligned! */
+};
+
+int unifont_new(unifont **out);
+unifont *unifont_ref(unifont *u);
+unifont *unifont_unref(unifont *u);
+
+DEFINE_TRIVIAL_CLEANUP_FUNC(unifont*, unifont_unref);
+
+unsigned int unifont_get_stride(unifont *u);
+int unifont_lookup(unifont *u, unifont_glyph *out, uint32_t ucs4);



More information about the systemd-commits mailing list