From 8b46e65aa3f057cd69aa5f58acbbdb735126c8c4 Mon Sep 17 00:00:00 2001 From: Paul LeoNerd Evans Date: Thu, 26 Jan 2012 10:07:23 +0000 Subject: Use termkey_set_flags() in constructor rather than copypasted logic --- termkey.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/termkey.c b/termkey.c index 7e5a473..1fadfb0 100644 --- a/termkey.c +++ b/termkey.c @@ -217,6 +217,8 @@ TermKey *termkey_new(int fd, int flags) if(!tk) return NULL; + tk->fd = fd; + if(!(flags & (TERMKEY_FLAG_RAW|TERMKEY_FLAG_UTF8))) { int locale_is_utf8 = 0; char *e; @@ -236,11 +238,7 @@ TermKey *termkey_new(int fd, int flags) flags |= TERMKEY_FLAG_RAW; } - tk->fd = fd; - tk->flags = flags; - - if(flags & TERMKEY_FLAG_SPACESYMBOL) - tk->canonflags |= TERMKEY_CANON_SPACESYMBOL; + termkey_set_flags(tk, flags); tk->buffer = malloc(tk->buffsize); if(!tk->buffer) -- cgit v1.2.3-70-g09d2