Skip to content

Commit

Permalink
Minor refactoring before first release
Browse files Browse the repository at this point in the history
  • Loading branch information
dudik committed Aug 23, 2020
1 parent c896d21 commit 8b455d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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
CC ?= cc
Expand Down
2 changes: 1 addition & 1 deletion config.def.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
static const char *background_color = "#3e3e3e";
static const char *border_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 int padding = 15;

Expand Down
6 changes: 3 additions & 3 deletions herbe.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int get_max_len(char *string, XftFont *font, int max_text_width)
return ++i;
}

if (info.width < max_text_width)
if (info.width <= max_text_width)
return eol;

int temp = eol;
Expand Down Expand Up @@ -133,13 +133,13 @@ int main(int argc, char *argv[])

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)
{
lines = realloc(lines, (lines_size += 5) * sizeof(char *));
if (!lines)
die("malloc failed");
die("realloc failed");
}

lines[num_of_lines] = malloc((eol + 1) * sizeof(char));
Expand Down

0 comments on commit 8b455d4

Please sign in to comment.