diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2018-02-28 10:06:47 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2018-02-28 10:06:47 +0100 |
commit | 9c3ce0048a4572e602dc9f23c36940993db4959b (patch) | |
tree | 89eaa553944ce36acae3b125de15340bb269dd87 /tools.c | |
parent | 3a3a2339947cb9ca9b319e180e0521079be8551d (diff) | |
download | vdr-9c3ce0048a4572e602dc9f23c36940993db4959b.tar.gz vdr-9c3ce0048a4572e602dc9f23c36940993db4959b.tar.bz2 |
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
Diffstat (limited to 'tools.c')
-rw-r--r-- | tools.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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) { |