Tint2conf: use strcat instead of append (issue #580)

This commit is contained in:
o9000 2016-05-18 23:27:55 +02:00
parent d49dac2e05
commit ed3fcd63fc
3 changed files with 6 additions and 19 deletions

View file

@ -158,15 +158,16 @@ void config_write_backgrounds(FILE *fp)
fprintf(fp, "rounded = %d\n", r); fprintf(fp, "rounded = %d\n", r);
fprintf(fp, "border_width = %d\n", b); fprintf(fp, "border_width = %d\n", b);
char *sides = "\0"; char sides[10];
sides[0] = '\0';
if (sideTop) if (sideTop)
sides = append(sides, 'T'); strcat(sides, "T");
if (sideBottom) if (sideBottom)
sides = append(sides, 'B'); strcat(sides, "B");
if (sideLeft) if (sideLeft)
sides = append(sides, 'L'); strcat(sides, "L");
if (sideRight) if (sideRight)
sides = append(sides, 'R'); strcat(sides, "R");
fprintf(fp, "border_sides = %s\n", sides); fprintf(fp, "border_sides = %s\n", sides);
config_write_color(fp, "background_color", *fillColor, fillOpacity); config_write_color(fp, "background_color", *fillColor, fillOpacity);

View file

@ -44,17 +44,6 @@
#include <librsvg/rsvg.h> #include <librsvg/rsvg.h>
#endif #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) void copy_file(const char *path_src, const char *path_dest)
{ {
if (g_str_equal(path_src, path_dest)) if (g_str_equal(path_src, path_dest))

View file

@ -41,9 +41,6 @@ typedef enum MouseAction {
#define ALL_DESKTOPS 0xFFFFFFFF #define ALL_DESKTOPS 0xFFFFFFFF
// add c to s
char *append(char *s, char c);
// Copies a file to another path // Copies a file to another path
void copy_file(const char *path_src, const char *path_dest); void copy_file(const char *path_src, const char *path_dest);