Compare commits
No commits in common. "6d4de1c208c41b360456cc656d4d0dd7eee913d6" and "5d6ddb5214759ccd03b087627d2ebad9f352d8f3" have entirely different histories.
6d4de1c208
...
5d6ddb5214
28
src/main.c
28
src/main.c
@ -5,9 +5,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#define ALLOCATION_CHUNK (1024UL)
|
|
||||||
#define ALLOCATION_LIMIT (1024UL * 1024UL)
|
|
||||||
|
|
||||||
enum { NORMAL, BOLD, DARKNESS, ITALIC, UNDERLINE, BLINK, DUNNO_6, REVERSE, INVISIBLE };
|
enum { NORMAL, BOLD, DARKNESS, ITALIC, UNDERLINE, BLINK, DUNNO_6, REVERSE, INVISIBLE };
|
||||||
enum { GREY, RED, GREEN, YELLOW, BLUE, PINK, CYAN, WHITE, CANCEL };
|
enum { GREY, RED, GREEN, YELLOW, BLUE, PINK, CYAN, WHITE, CANCEL };
|
||||||
|
|
||||||
@ -249,15 +246,9 @@ static int render_word (
|
|||||||
++data_offset;
|
++data_offset;
|
||||||
} while ((is_separator (buffer [data_offset]) == 0) && (buffer [data_offset] != '\0'));
|
} while ((is_separator (buffer [data_offset]) == 0) && (buffer [data_offset] != '\0'));
|
||||||
|
|
||||||
free (word);
|
|
||||||
|
|
||||||
return (data_offset);
|
return (data_offset);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
Valgrind: Depends on uninitialized value (buffer [0])...?
|
|
||||||
280 : } while ((buffer [buffer_size - 1] != '\0') || (buffer_size != ALLOCATION_LIMIT));
|
|
||||||
285 : while (buffer [offset] != '\0') {
|
|
||||||
*/
|
|
||||||
int main (
|
int main (
|
||||||
int argc,
|
int argc,
|
||||||
char * * argv
|
char * * argv
|
||||||
@ -270,21 +261,18 @@ int main (
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = realloc (buffer, ALLOCATION_CHUNK);
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if ((buffer_size + 1) % ALLOCATION_CHUNK == 0) {
|
|
||||||
buffer = realloc (buffer, ((buffer_size + 1) / ALLOCATION_CHUNK + 1) * ALLOCATION_CHUNK);
|
|
||||||
}
|
|
||||||
buffer [buffer_size] = '\0'; /* Fixing Valgrind warnings... */
|
|
||||||
read (STDIN_FILENO, & buffer [buffer_size], sizeof (* buffer));
|
|
||||||
++buffer_size;
|
++buffer_size;
|
||||||
} while ((buffer [buffer_size - 1] != '\0') /*|| (buffer_size != ALLOCATION_LIMIT)*/);
|
buffer = realloc (buffer, buffer_size);
|
||||||
|
read (STDIN_FILENO, & buffer [buffer_size - 1], sizeof (* buffer));
|
||||||
|
} while ((buffer [buffer_size] != '\0') || (buffer_size != 10000));
|
||||||
|
|
||||||
buffer [buffer_size - 1] = '\0';
|
++buffer_size;
|
||||||
|
buffer = realloc (buffer, buffer_size);
|
||||||
|
buffer [buffer_size] = '\0';
|
||||||
|
|
||||||
/* Checking if long comments work... */
|
/* Checking if long comments work... */
|
||||||
// Checking if short comments work...
|
// Checking if long comments work...
|
||||||
|
|
||||||
while (buffer [offset] != '\0') {
|
while (buffer [offset] != '\0') {
|
||||||
if ((buffer [offset] == '/') && (buffer [offset + 1] == '/')) {
|
if ((buffer [offset] == '/') && (buffer [offset + 1] == '/')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user