summaryrefslogtreecommitdiff
path: root/kicad
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-30 06:49:49 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-30 06:49:49 -0300
commit9a0fe02922549d804ba0e4a9c8535ce25f7930d9 (patch)
tree44caf72d27bd070597a7a846fbb9f44f40a92568 /kicad
parentfe2d12a590aa637881c7f3fc53d3cca9e246c195 (diff)
downloadeeshow-9a0fe02922549d804ba0e4a9c8535ce25f7930d9.tar.gz
eeshow-9a0fe02922549d804ba0e4a9c8535ce25f7930d9.tar.bz2
eeshow-9a0fe02922549d804ba0e4a9c8535ce25f7930d9.zip
misc/util.h (alloc_printf): error-checking vasprintf wrapper; use it
Diffstat (limited to 'kicad')
-rw-r--r--kicad/dwg.c3
-rw-r--r--kicad/pl-render.c5
-rw-r--r--kicad/sch-render.c6
3 files changed, 6 insertions, 8 deletions
diff --git a/kicad/dwg.c b/kicad/dwg.c
index 2779867..fc0efa2 100644
--- a/kicad/dwg.c
+++ b/kicad/dwg.c
@@ -11,7 +11,6 @@
*/
-#define _GNU_SOURCE /* for asprintf */
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
@@ -267,7 +266,7 @@ void dwg_glabel(struct gfx *gfx, int x, int y, const char *s, int dir, int dim,
if (bbox)
bbox_from_poly(bbox, n, vx, vy);
- if (asprintf(&tag, "G:%s", s)) {}
+ alloc_printf(&tag, "G:%s", s);
gfx_tag(gfx, tag, n, vx, vy);
}
diff --git a/kicad/pl-render.c b/kicad/pl-render.c
index 914eee7..c56519c 100644
--- a/kicad/pl-render.c
+++ b/kicad/pl-render.c
@@ -10,7 +10,6 @@
* (at your option) any later version.
*/
-#define _GNU_SOURCE /* for asprintf */
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
@@ -88,7 +87,7 @@ static char *expand(const struct pl_ctx *pl, const char *s,
n = 0;
for (sch = sheets; sch; sch = sch->next)
n++;
- if (asprintf(&x, "%u", n)) {}
+ alloc_printf(&x, "%u", n);
break;
case 'P':
x = "%P"; // sheet path
@@ -101,7 +100,7 @@ static char *expand(const struct pl_ctx *pl, const char *s,
for (sch = sheets; sch != sheet;
sch = sch->next)
n++;
- if (asprintf(&x, "%u", n)) {}
+ alloc_printf(&x, "%u", n);
break;
case 'T':
x = (char *) sheet->title;
diff --git a/kicad/sch-render.c b/kicad/sch-render.c
index 5d3c9e0..52be40f 100644
--- a/kicad/sch-render.c
+++ b/kicad/sch-render.c
@@ -11,10 +11,10 @@
*/
-#define _GNU_SOURCE /* for asprintf */
#include <stdio.h>
#include <assert.h>
+#include "misc/util.h"
#include "misc/diag.h"
#include "gfx/misc.h"
#include "gfx/style.h"
@@ -82,7 +82,7 @@ static void do_hsheet_text(const struct sch_obj *obj,
.vert = text_min,
.style = text_normal,
};
- if (asprintf(&s, "Sheet: %s", sheet->name)) {}
+ alloc_printf(&s, "Sheet: %s", sheet->name);
sheet_txt.s = s; /* work around "const" mismatch */
struct text file_txt = {
@@ -94,7 +94,7 @@ static void do_hsheet_text(const struct sch_obj *obj,
.vert = text_max,
.style = text_normal,
};
- if (asprintf(&s, "File: %s", sheet->file)) {}
+ alloc_printf(&s, "File: %s", sheet->file);
file_txt.s = s; /* work around "const" mismatch */
if (sheet->rotated) {