Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.
Rust agent-skillsclaude-codeclicode-migrationcodexffigolangjavajavascriptmcpmigrationnapiperformanceportingpyo3pythonrewriterubyrusttypescript
C: count gethostname, getlogin, getpid and secure_getenv as environment reads (#1413)
jakalijey9eec94d03bb1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8e6fe66f..4f3ae032 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -267,6 +267,9 @@- PowerShell: a parameter typed `[decimal]`, `[uint64]` or `[ulong]` keeps its function inPowerShell, with the reasons C# gives for the same types, instead of bridging it as `f64` or`i64`. `[uint32]`, `[double]` and `[single]` bridge as before (#1341 by @jakalijey).+- C: `secure_getenv`, `gethostname`, `getlogin`, `getlogin_r`, `getpid`, `getuid` and `uname`+ count as reading the machine or the process, as `getenv` and `getcwd` already did, in `analyze`+ and `bridge` (#1406 by @jakalijey).- Python: a port takes each keyword argument under its name in the original. The package maps`maxLen=5` and `N=2` to the binding's `max_len` and `n` before calling the native function,where it raised `TypeError` in `shadow` and `new` mode. Parameters already in snake_casediff --git a/src/lang/effects.rs b/src/lang/effects.rsindex 8a569f51..644df3d2 100644--- a/src/lang/effects.rs+++ b/src/lang/effects.rs@@ -192,7 +192,17 @@ fn environment(lang: Lang) -> &'static [&'static str] {"NSTemporaryDirectory(","getenv(",],- Lang::C => &["getenv(", "getcwd("],+ Lang::C => &[+ "getenv(",+ "getcwd(",+ "secure_getenv(",+ "gethostname(",+ "getlogin(",+ "getlogin_r(",+ "getpid(",+ "getuid(",+ "uname(",+ ],}}@@ -1463,6 +1473,18 @@ mod tests {(Lang::Ruby, "def self.f(x)\n ENV.fetch('HOME') + x\nend"),(Lang::Php, "function f($x) { return getenv('HOME') . $x; }"),(Lang::Powershell, "function F { param($X) $env:HOME + $X }"),+ (+ Lang::C,+ "int f(int x) {\n return getenv(\"HOME\") ? x : 0;\n}",+ ),+ (+ Lang::C,+ "int f(int x) {\n return secure_getenv(\"HOME\") ? x : 0;\n}",+ ),+ (+ Lang::C,+ "int f(int x) {\n char buf[64];\n gethostname(buf, sizeof buf);\n return buf[0] + x;\n}",+ ),];for (lang, code) in env {let why = reason(*lang, &["x"], code);