Minor refactoring before first release
This commit is contained in:
parent
c896d21ab2
commit
8b455d4ced
3 changed files with 5 additions and 5 deletions
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
||||||
CFLAGS = -Wall -Wextra -pedantic -lX11 -lXft -I/usr/include/freetype2 -lm -pthread
|
CFLAGS = -Wall -Wextra -pedantic -lX11 -lXft -I/usr/include/freetype2 -pthread
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
CC ?= cc
|
CC ?= cc
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
static const char *background_color = "#3e3e3e";
|
static const char *background_color = "#3e3e3e";
|
||||||
static const char *border_color = "#ececec";
|
static const char *border_color = "#ececec";
|
||||||
static const char *font_color = "#ececec";
|
static const char *font_color = "#ececec";
|
||||||
static const char *font_pattern = "Inconsolata:style=Medium:size=12";
|
static const char *font_pattern = "monospace:size=10";
|
||||||
static const unsigned line_spacing = 5;
|
static const unsigned line_spacing = 5;
|
||||||
static const unsigned int padding = 15;
|
static const unsigned int padding = 15;
|
||||||
|
|
||||||
|
|
6
herbe.c
6
herbe.c
|
@ -56,7 +56,7 @@ int get_max_len(char *string, XftFont *font, int max_text_width)
|
||||||
return ++i;
|
return ++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.width < max_text_width)
|
if (info.width <= max_text_width)
|
||||||
return eol;
|
return eol;
|
||||||
|
|
||||||
int temp = eol;
|
int temp = eol;
|
||||||
|
@ -133,13 +133,13 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++)
|
for (int i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
for (unsigned int eol = get_max_len(argv[i], font, max_text_width); eol <= strlen(argv[i]) && eol; argv[i] += eol, num_of_lines++, eol = get_max_len(argv[i], font, max_text_width))
|
for (unsigned int eol = get_max_len(argv[i], font, max_text_width); eol; argv[i] += eol, num_of_lines++, eol = get_max_len(argv[i], font, max_text_width))
|
||||||
{
|
{
|
||||||
if (lines_size <= num_of_lines)
|
if (lines_size <= num_of_lines)
|
||||||
{
|
{
|
||||||
lines = realloc(lines, (lines_size += 5) * sizeof(char *));
|
lines = realloc(lines, (lines_size += 5) * sizeof(char *));
|
||||||
if (!lines)
|
if (!lines)
|
||||||
die("malloc failed");
|
die("realloc failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
lines[num_of_lines] = malloc((eol + 1) * sizeof(char));
|
lines[num_of_lines] = malloc((eol + 1) * sizeof(char));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue