summaryrefslogtreecommitdiff
path: root/src/bin/embryo
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@samsung.com>2013-03-25 18:44:21 +0900
committerCedric BAIL <cedric.bail@samsung.com>2013-03-25 18:45:42 +0900
commit6e8fe3b03d179f65ca87e0cf744907903e150c5b (patch)
tree6b27cdd45ed416e3f8a1031c32d5dd37accadc54 /src/bin/embryo
parent70f8bd50eb16d00e7902a5a4e7452f25fb59d052 (diff)
embryo: use eina_file_mkstemp.
Diffstat (limited to 'src/bin/embryo')
-rw-r--r--src/bin/embryo/embryo_cc_sc.h1
-rw-r--r--src/bin/embryo/embryo_cc_sc1.c16
-rw-r--r--src/bin/embryo/embryo_cc_scvars.c1
3 files changed, 4 insertions, 14 deletions
diff --git a/src/bin/embryo/embryo_cc_sc.h b/src/bin/embryo/embryo_cc_sc.h
index 9eaf6b86e0..965e580942 100644
--- a/src/bin/embryo/embryo_cc_sc.h
+++ b/src/bin/embryo/embryo_cc_sc.h
@@ -620,7 +620,6 @@ extern constvalue libname_tab; /* library table (#pragma library "..." syntax) *
620extern constvalue *curlibrary; /* current library */ 620extern constvalue *curlibrary; /* current library */
621extern symbol *curfunc; /* pointer to current function */ 621extern symbol *curfunc; /* pointer to current function */
622extern char *inpfname; /* name of the file currently read from */ 622extern char *inpfname; /* name of the file currently read from */
623extern char outfname[]; /* output file name */
624extern char sc_ctrlchar; /* the control character (or escape character) */ 623extern char sc_ctrlchar; /* the control character (or escape character) */
625extern int litidx; /* index to literal table */ 624extern int litidx; /* index to literal table */
626extern int litmax; /* current size of the literal table */ 625extern int litmax; /* current size of the literal table */
diff --git a/src/bin/embryo/embryo_cc_sc1.c b/src/bin/embryo/embryo_cc_sc1.c
index 14b6b1cbc1..dfef9472cd 100644
--- a/src/bin/embryo/embryo_cc_sc1.c
+++ b/src/bin/embryo/embryo_cc_sc1.c
@@ -267,6 +267,7 @@ sc_compile(int argc, char *argv[])
267 char lcl_ctrlchar; 267 char lcl_ctrlchar;
268 int lcl_packstr, lcl_needsemicolon, lcl_tabsize; 268 int lcl_packstr, lcl_needsemicolon, lcl_tabsize;
269 char *tmpdir; 269 char *tmpdir;
270 Eina_Tmpstr *outfname;
270 271
271 /* set global variables to their initial value */ 272 /* set global variables to their initial value */
272 binf = NULL; 273 binf = NULL;
@@ -291,16 +292,7 @@ sc_compile(int argc, char *argv[])
291 setopt(argc, argv, inpfname, binfname, incfname, reportname); 292 setopt(argc, argv, inpfname, binfname, incfname, reportname);
292 293
293 /* open the output file */ 294 /* open the output file */
294 295 fd_out = eina_file_mkstemp("embryo_cc.asm-tmp-XXXXXX", &outfname);
295#ifndef HAVE_EVIL
296 tmpdir = getenv("TMPDIR");
297 if (!tmpdir) tmpdir = "/tmp";
298#else
299 tmpdir = (char *)evil_tmpdir_get();
300#endif /* ! HAVE_EVIL */
301
302 snprintf(outfname, PATH_MAX, "%s/embryo_cc.asm-tmp-XXXXXX", tmpdir);
303 fd_out = mkstemp(outfname);
304 if (fd_out < 0) 296 if (fd_out < 0)
305 error(101, outfname); 297 error(101, outfname);
306 298
@@ -407,7 +399,8 @@ sc_compile(int argc, char *argv[])
407 } /* if */ 399 } /* if */
408 if (outf) 400 if (outf)
409 sc_closeasm(outf); 401 sc_closeasm(outf);
410 unlink (outfname); 402 unlink(outfname);
403 eina_tmpstr_del(outfname);
411 if (binf) 404 if (binf)
412 sc_closebin(binf, errnum != 0); 405 sc_closebin(binf, errnum != 0);
413 406
@@ -550,7 +543,6 @@ initglobals(void)
550 sc_rationaltag = 0; /* assume no support for rational numbers */ 543 sc_rationaltag = 0; /* assume no support for rational numbers */
551 rational_digits = 0; /* number of fractional digits */ 544 rational_digits = 0; /* number of fractional digits */
552 545
553 outfname[0] = '\0'; /* output file name */
554 inpf = NULL; /* file read from */ 546 inpf = NULL; /* file read from */
555 inpfname = NULL; /* pointer to name of the file currently 547 inpfname = NULL; /* pointer to name of the file currently
556 * read from */ 548 * read from */
diff --git a/src/bin/embryo/embryo_cc_scvars.c b/src/bin/embryo/embryo_cc_scvars.c
index f369b9b928..0609a9bc33 100644
--- a/src/bin/embryo/embryo_cc_scvars.c
+++ b/src/bin/embryo/embryo_cc_scvars.c
@@ -45,7 +45,6 @@ constvalue libname_tab = { NULL, "", 0, 0 }; /* library table (#pragma library "
45constvalue *curlibrary = NULL; /* current library */ 45constvalue *curlibrary = NULL; /* current library */
46symbol *curfunc; /* pointer to current function */ 46symbol *curfunc; /* pointer to current function */
47char *inpfname; /* pointer to name of the file currently read from */ 47char *inpfname; /* pointer to name of the file currently read from */
48char outfname[PATH_MAX]; /* output file name */
49char sc_ctrlchar = CTRL_CHAR; /* the control character (or escape character) */ 48char sc_ctrlchar = CTRL_CHAR; /* the control character (or escape character) */
50int litidx = 0; /* index to literal table */ 49int litidx = 0; /* index to literal table */
51int litmax = sDEF_LITMAX; /* current size of the literal table */ 50int litmax = sDEF_LITMAX; /* current size of the literal table */