lib: update the environ module to use the light FFI
authorAlexis Laferrière <alexis.laf@xymus.net>
Tue, 16 Jun 2015 17:53:14 +0000 (13:53 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 16 Jun 2015 17:53:40 +0000 (13:53 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/standard/environ.nit
lib/standard/environ_nit.h [deleted file]

index 4b2d632..adfbedd 100644 (file)
@@ -57,8 +57,8 @@ redef class String
 end
 
 redef class NativeString
-       private fun get_environ: NativeString is extern "string_NativeString_NativeString_get_environ_0"
-       private fun setenv( v : NativeString ) is extern "string_NativeString_NativeString_setenv_1"
+       private fun get_environ: NativeString `{ return getenv(self); `}
+       private fun setenv(value: NativeString) `{ setenv(self, value, 1); `}
 end
 
 redef class Sys
diff --git a/lib/standard/environ_nit.h b/lib/standard/environ_nit.h
deleted file mode 100644 (file)
index 1938065..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __ENVIRON_NIT_H
-#define __ENVIRON_NIT_H
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2008 Floréal Morandat <morandat@lirmm.fr> 
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A 
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include <stdlib.h>
-
-#define string_NativeString_NativeString_get_environ_0(self) getenv(self)
-#define string_NativeString_NativeString_setenv_1(self,v) setenv(self,v, 1)
-
-#endif