shithub: mc

Download patch

ref: c4490ec5e0de5243fcb8505805840e2ad29e018a
parent: b7b8419325f47cb8d6d2f9a5506a43257294351f
parent: ba6a34ede9eb9e706c09fc7a3159157b3412a6ba
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jan 16 22:15:19 EST 2016

Merge branch 'master' of https://github.com/oridb/mc

--- a/lib/std/mktemp.myr
+++ b/lib/std/mktemp.myr
@@ -20,7 +20,7 @@
 const Retries = 100
 
 const mktemp = {base, opt, mode
-	var tmpdir, path, uniq
+	var tmpdir, path
 
 	match std.getenv("TMPDIR")
 	| `std.Some d:	tmpdir = d
@@ -28,21 +28,18 @@
 	;;
 
 	for var i = 0; i < Retries; i++
-		uniq = randpath(tmpdir, base)
-		path = pathcat(tmpdir, uniq)
+		path = randpath(tmpdir, base)
 		match std.openmode(path, opt | Ocreat, mode)
 		| `Fail e:
 			if e != Eexist
-				std.slfree(uniq)
+				std.slfree(path)
 				std.slfree(tmpdir)
 				-> `Fail e
 			;;
 		| `Ok fd:
-			std.slfree(uniq)
 			std.slfree(tmpdir)
 			-> `Ok (fd, path)
 		;;
-		std.slfree(uniq)
 		std.slfree(path)
 	;;
 	std.slfree(tmpdir)
--- a/lib/std/rand.myr
+++ b/lib/std/rand.myr
@@ -183,7 +183,7 @@
 	;;
 	r = rand32(rng)
 	for ; n != buf.len; n++
-		buf[n++] = (r & 0xff) castto(byte)
+		buf[n] = (r & 0xff) castto(byte)
 		r >>= 8
 	;;
 	-> n
--- a/rt/abort-freebsd.s
+++ b/rt/abort-freebsd.s
@@ -8,11 +8,11 @@
 	movq	(%rsp),%rax
 	movq	$15,%rdx
 	leaq	.digitchars(%rip),%r8
-        leaq    .pcstr(%rip),%r9
+	leaq    .pcstr(%rip),%r9
 .loop:
 	movq	%rax, %rcx
 	andq	$0xf, %rcx
-        movb    (%r8,%rcx),%r10b
+	movb    (%r8,%rcx),%r10b
 	movb	%r10b,(%r9,%rdx)
 	subq	$1, %rdx
 	shrq	$4, %rax
--- a/rt/abort-osx.s
+++ b/rt/abort-osx.s
@@ -8,11 +8,11 @@
 	movq	(%rsp),%rax
 	movq	$15,%rdx
 	leaq	.digitchars(%rip),%r8
-        leaq    .pcstr(%rip),%r9
+	leaq    .pcstr(%rip),%r9
 .loop:
 	movq	%rax, %rcx
 	andq	$0xf, %rcx
-        movb    (%r8,%rcx),%r10b
+	movb    (%r8,%rcx),%r10b
 	movb	%r10b,(%r9,%rdx)
 	subq	$1, %rdx
 	shrq	$4, %rax
--- a/rt/common.s
+++ b/rt/common.s
@@ -40,7 +40,7 @@
  * argc in %rax, argv in %rbx, dest vector in %rcx
  */
 cvt:
-        jmp .cvttest
+	jmp .cvttest
 .cvtloop:
 	subq	$1,%rax
 	movq	(%rbx),%r8
@@ -53,5 +53,5 @@
 	testq	%rax,%rax
 	jnz .cvtloop
 .cvtdone:
-        ret
+	ret
 
--- a/rt/start-freebsd.s
+++ b/rt/start-freebsd.s
@@ -27,7 +27,7 @@
 	/* stack allocate sizeof(byte[:])*(argc + len(envp)) */
 	movq	(%rdi),%rax
 	leaq	16(%rdi,%rax,8), %rbx	/* argp = argv + 8*argc + 8 */
-        call    count
+	call    count
 	addq	%r9,%rax
 	imulq	$16,%rax
 	subq	%rax,%rsp
@@ -36,20 +36,20 @@
 	/* convert envp to byte[:][:] for std._environment */
 	movq	(%rdi),%rax
 	leaq	16(%rdi,%rax,8), %rbx	/* envp = argv + 8*argc + 8 */
-        /* store envp for some syscalls to use without spurious conversion. */
-        movq    %rbx,sys$__cenvp(%rip)
+	/* store envp for some syscalls to use without spurious conversion. */
+	movq    %rbx,sys$__cenvp(%rip)
 	movq	%r9,%rax
 	movq	%rsp, %rcx
-	movq	%r9,.envlen
-	movq	%rdx,.envbase
-	call cvt
+	movq	%r9,.envlen(%rip)
+	movq	%rdx,.envbase(%rip)
+	call	cvt
 	movq	%rcx,%rdx
 
-        /* convert argc, argv to byte[:][:] for args. */
+	/* convert argc, argv to byte[:][:] for args. */
 	movq	(%rdi), %rax	/* argc */
 	leaq	8(%rdi), %rbx	/* argv */
 	movq	(%rdi), %rsi	/* saved argc */
-        call    cvt
+	call    cvt
 	pushq   %rsi
 	pushq   %rdx
 
@@ -59,7 +59,7 @@
 	/* enter the main program */
 	call	main
 	/* exit(0) */
-        xorq	%rdi,%rdi
+	xorq	%rdi,%rdi
 	movq	$1,%rax
 	syscall
 
--- a/rt/start-linux.s
+++ b/rt/start-linux.s
@@ -49,22 +49,22 @@
 	/* convert envp to byte[:][:] for sys._environment */
 	movq	(%rbp),%rax
 	leaq	16(%rbp,%rax,8), %rbx	/* envp = argv + 8*argc + 8 */
-        /* store envp for some syscalls to use without converting */
-        movq    %rbx,sys$__cenvp(%rip)
+	/* store envp for some syscalls to use without converting */
+	movq    %rbx,sys$__cenvp(%rip)
 	movq	%r9,%rax
 	movq	%rsp, %rcx
-	movq	%r9,.envlen
-	movq	%rdx,.envbase
-	call cvt
+	movq	%r9,.envlen(%rip)
+	movq	%rdx,.envbase(%rip)
+	call	cvt
 	movq	%rcx,%rdx
 
-        /* convert argc, argv to byte[:][:] for args. */
+	/* convert argc, argv to byte[:][:] for args. */
 	movq	(%rbp), %rax	/* argc */
 	leaq	8(%rbp), %rbx	/* argv */
 	movq	(%rbp), %rsi	/* saved argc */
-        call cvt
-	pushq %rsi
-	pushq %rdx
+	call	cvt
+	pushq	%rsi
+	pushq	%rdx
 
 	/* call pre-main initializers */
 	call	__init__
@@ -71,7 +71,7 @@
 	/* enter the main program */
 	call	main
 	/* exit(0) */
-        xorq	%rdi,%rdi
+	xorq	%rdi,%rdi
 	movq	$60,%rax
 	syscall
 
--- a/rt/start-osx.s
+++ b/rt/start-osx.s
@@ -29,7 +29,7 @@
 	/* stack allocate sizeof(byte[:])*(argc + len(envp)) */
 	movq	(%rbp),%rax
 	leaq	16(%rbp,%rax,8), %rbx	/* argp = argv + 8*argc + 8 */
-        call    count
+	call    count
 	addq	%r9,%rax
 	imulq	$16,%rax
 	subq	%rax,%rsp
@@ -38,21 +38,21 @@
 	/* convert envp to byte[:][:] for sys._environment */
 	movq	(%rbp),%rax
 	leaq	16(%rbp,%rax,8), %rbx	/* envp = argv + 8*argc + 8 */
-        movq    %rbx,_sys$__cenvp(%rip)
+	movq    %rbx,_sys$__cenvp(%rip)
 	movq	%r9,%rax
 	movq	%rsp, %rcx
 	movq	%r9,.envlen(%rip)
 	movq	%rdx,.envbase(%rip)
-	call cvt
+	call	cvt
 	movq	%rcx,%rdx
 
-        /* convert argc, argv to byte[:][:] for args. */
+	/* convert argc, argv to byte[:][:] for args. */
 	movq	(%rbp), %rax	/* argc */
 	leaq	8(%rbp), %rbx	/* argv */
 	movq	(%rbp), %rsi	/* saved argc */
-        call cvt
-	pushq %rsi
-	pushq %rdx
+	call	cvt
+	pushq	%rsi
+	pushq	%rdx
 
 	call	___init__
 	/* enter the main program */