aboutsummaryrefslogtreecommitdiff
path: root/src/wrap.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-03-07 23:28:23 +0100
committerThomas White <taw@bitwiz.org.uk>2013-03-07 23:28:23 +0100
commitb4fa75b9ac5160dae40c4763ba87927762d4e75f (patch)
tree3e39da4341f93129900a1a22b3ad7f1e92272505 /src/wrap.c
parentd9c5d4dc8b80a151eb36fe47fa13b746103e773c (diff)
Wrapping and rendering fixes
Diffstat (limited to 'src/wrap.c')
-rw-r--r--src/wrap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wrap.c b/src/wrap.c
index 5ecee08..10c225d 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -468,7 +468,7 @@ static void output(int a, int i, int *p, struct frame *fr,
l->max_boxes = s-q;
alloc_boxes(l);
- for ( j=q+1; j<=s; j++ ) {
+ for ( j=q; j<s; j++ ) {
l->boxes[l->n_boxes++] = boxes->boxes[j];
}
@@ -528,13 +528,13 @@ static void knuth_suboptimal_fit(struct wrap_line *boxes, double line_length,
}
if ( reject ) return;
- p = malloc(boxes->n_boxes*sizeof(int));
+ p = calloc(boxes->n_boxes, sizeof(int));
if ( p == NULL ) {
fprintf(stderr, "Failed to allocate p_k\n");
return;
}
- s = malloc(boxes->n_boxes*sizeof(double));
+ s = calloc(boxes->n_boxes, sizeof(double));
if ( s == NULL ) {
fprintf(stderr, "Failed to allocate s_k\n");
return;