Tint2conf: use strcat instead of append (issue #580)
o9000 mrovi9000@gmail.com
3 files changed,
6 insertions(+),
19 deletions(-)
M
src/tint2conf/properties_rw.c
→
src/tint2conf/properties_rw.c
@@ -158,15 +158,16 @@ fprintf(fp, "# Background %d: %s\n", index, text ? text : "");
fprintf(fp, "rounded = %d\n", r); fprintf(fp, "border_width = %d\n", b); - char *sides = "\0"; + char sides[10]; + sides[0] = '\0'; if (sideTop) - sides = append(sides, 'T'); + strcat(sides, "T"); if (sideBottom) - sides = append(sides, 'B'); + strcat(sides, "B"); if (sideLeft) - sides = append(sides, 'L'); + strcat(sides, "L"); if (sideRight) - sides = append(sides, 'R'); + strcat(sides, "R"); fprintf(fp, "border_sides = %s\n", sides); config_write_color(fp, "background_color", *fillColor, fillOpacity);
M
src/util/common.c
→
src/util/common.c
@@ -44,17 +44,6 @@ #ifdef HAVE_RSVG
#include <librsvg/rsvg.h> #endif -char *append(char *s, char c) { - int len = strlen(s); - char buf[len+2]; - - strcpy(buf, s); - buf[len] = c; - buf[len + 1] = 0; - - return strdup(buf); -} - void copy_file(const char *path_src, const char *path_dest) { if (g_str_equal(path_src, path_dest))
M
src/util/common.h
→
src/util/common.h
@@ -41,9 +41,6 @@ } MouseAction;
#define ALL_DESKTOPS 0xFFFFFFFF -// add c to s -char *append(char *s, char c); - // Copies a file to another path void copy_file(const char *path_src, const char *path_dest);