From 9c3ce0048a4572e602dc9f23c36940993db4959b Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 28 Feb 2018 10:06:47 +0100 Subject: When remote timers are fetched from a peer VDR, we no longer blindly delete and re-add them, but rather compare them and make only the minimum necessary changes --- tools.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tools.c') diff --git a/tools.c b/tools.c index ac2f9eb2..28e03cdc 100644 --- a/tools.c +++ b/tools.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 4.8 2017/06/25 11:45:39 kls Exp $ + * $Id: tools.c 4.9 2018/02/27 10:09:21 kls Exp $ */ #include "tools.h" @@ -296,6 +296,18 @@ cString strgetval(const char *s, const char *name, char d) return NULL; } +char *strshift(char *s, int n) +{ + if (s && n > 0) { + int l = strlen(s); + if (n < l) + memmove(s, s + n, l - n + 1); // we also copy the terminating 0! + else + *s = 0; + } + return s; +} + bool startswith(const char *s, const char *p) { while (*p) { -- cgit v1.2.3