chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove unused includes
[elogind.git]
/
src
/
libsystemd-terminal
/
subterm.c
diff --git
a/src/libsystemd-terminal/subterm.c
b/src/libsystemd-terminal/subterm.c
index 78efc9d7c0f6d7e31f1636cbf7a2effcdee95d2a..983a2a14abd74bacbb232396597b1a6eff2b2ea0 100644
(file)
--- a/
src/libsystemd-terminal/subterm.c
+++ b/
src/libsystemd-terminal/subterm.c
@@
-26,7
+26,6
@@
* parent TTY. Think of this like what "GNU-screen" does.
*/
* parent TTY. Think of this like what "GNU-screen" does.
*/
-#include <assert.h>
#include <errno.h>
#include <stdarg.h>
#include <stdbool.h>
#include <errno.h>
#include <stdarg.h>
#include <stdbool.h>
@@
-41,6
+40,7
@@
#include "sd-event.h"
#include "term-internal.h"
#include "util.h"
#include "sd-event.h"
#include "term-internal.h"
#include "util.h"
+#include "utf8.h"
typedef struct Output Output;
typedef struct Terminal Terminal;
typedef struct Output Output;
typedef struct Terminal Terminal;
@@
-160,16
+160,14
@@
static int output_write(Output *o, const void *buf, size_t size) {
_printf_(3,0)
static int output_vnprintf(Output *o, size_t max, const char *format, va_list args) {
_printf_(3,0)
static int output_vnprintf(Output *o, size_t max, const char *format, va_list args) {
- char buf[
4096
];
+ char buf[
max
];
int r;
assert_return(o, -EINVAL);
assert_return(format, -EINVAL);
int r;
assert_return(o, -EINVAL);
assert_return(format, -EINVAL);
- assert_return(max <=
sizeof(buf)
, -EINVAL);
+ assert_return(max <=
4096
, -EINVAL);
- r = vsnprintf(buf, max, format, args);
- if (r > (ssize_t)max)
- r = max;
+ r = MIN(vsnprintf(buf, max, format, args), (int) max);
return output_write(o, buf, r);
}
return output_write(o, buf, r);
}
@@
-459,7
+457,7
@@
static int output_draw_cell_fn(term_screen *screen,
output_printf(o, " ");
} else {
for (k = 0; k < n_ch; ++k) {
output_printf(o, " ");
} else {
for (k = 0; k < n_ch; ++k) {
- ulen =
term_utf8_encode
(utf8, ch[k]);
+ ulen =
utf8_encode_unichar
(utf8, ch[k]);
output_write(o, utf8, ulen);
}
}
output_write(o, utf8, ulen);
}
}
@@
-625,7
+623,7
@@
static int terminal_push_tmp(Terminal *t, uint32_t ucs4) {
assert(t);
assert(t);
- len =
term_utf8_encode
(buf, ucs4);
+ len =
utf8_encode_unichar
(buf, ucs4);
if (len < 1)
return 0;
if (len < 1)
return 0;