From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Sat, 30 Sep 2017 12:55:27 +0100 Subject: [PATCH 1/5] html: html_ntxt with no ellipsis In-Reply-To: <20170927224331.26494-2-whydoubt@gmail.com> References: <20170923033848.5922-1-whydoubt@gmail.com> <20170927224331.26494-1-whydoubt@gmail.com> <20170927224331.26494-2-whydoubt@gmail.com> Message-ID: <20170930115527.GA2327@john.keeping.me.uk> On Wed, Sep 27, 2017 at 05:43:27PM -0500, Jeff Smith wrote: > For implementing a ui-blame page, there is need for a function that > outputs a selection from a block of text, transformed for HTML output, > but with no further modifications or additions. > > Signed-off-by: Jeff Smith > --- > html.c | 24 ++++-------------------- > html.h | 2 +- > ui-repolist.c | 3 ++- > 3 files changed, 7 insertions(+), 22 deletions(-) > > diff --git a/html.c b/html.c > index e7e6e07..87ef5aa 100644 > --- a/html.c > +++ b/html.c > @@ -124,26 +124,11 @@ void html_vtxtf(const char *format, va_list ap) [snip] > -void html_ntxt(int len, const char *txt) > +int html_ntxt(int len, const char *txt) Should this be: ssize_t html_ntxt(size_t len, const char *txt) ? Maybe with a check to die if len > SSIZE_MAX. > { > const char *t = txt; > while (t && *t && len--) { > @@ -162,8 +147,7 @@ void html_ntxt(int len, const char *txt) > } > if (t != txt) > html_raw(txt, t - txt); > - if (len < 0) > - html("..."); > + return len; > }