tsort style fixes
getline() cannot return 0 so no need to guard against that.
This commit is contained in:
parent
102baab4c4
commit
9a2b8d3531
8
tsort.c
8
tsort.c
|
@ -6,9 +6,7 @@
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#define WHITE 0
|
enum { WHITE = 0, GREY, BLACK };
|
||||||
#define GREY 1
|
|
||||||
#define BLACK 2
|
|
||||||
|
|
||||||
struct vertex;
|
struct vertex;
|
||||||
|
|
||||||
|
@ -104,8 +102,8 @@ load_graph(FILE *fp)
|
||||||
struct vertex *from = 0;
|
struct vertex *from = 0;
|
||||||
|
|
||||||
while ((len = getline(&line, &size, fp)) != -1) {
|
while ((len = getline(&line, &size, fp)) != -1) {
|
||||||
if (len && line[len - 1] == '\n')
|
if (line[len - 1] == '\n')
|
||||||
line[len - 1] = 0;
|
line[--len] = 0;
|
||||||
for (p = line; p;) {
|
for (p = line; p;) {
|
||||||
SKIP(name, p, isspace);
|
SKIP(name, p, isspace);
|
||||||
if (!*name)
|
if (!*name)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user