[libc-commits] [libc] [libc] implement localtime (PR #110363)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Wed Dec 25 23:06:40 PST 2024


=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0J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vSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=,
=?utf-8?b?0JfQuNGI0LDQvSDQnNC40YDQtw==?=
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/110363 at github.com>


================
@@ -26,6 +31,26 @@ static int64_t computeRemainingYears(int64_t daysPerYears,
   return years;
 }
 
+volatile int file_usage = 0;
+
+void release_file(FILE *fp, char *timezone) {
+  file_usage = 0;
+  fclose(fp);
+}
+
+void acquire_file(FILE *fp, char *timezone, size_t timezone_size) {
+  while (1) {
+    if (file_usage == 0) {
+      file_usage = 1;
+      break;
+    }
+  }
+
+  if (fgets(timezone, (int)timezone_size, fp) == NULL) {
+    release_file(fp, timezone);
+  }
+}
----------------
petrhosek wrote:

I don't see any RAII use, have you pushed all your changes?

https://github.com/llvm/llvm-project/pull/110363


More information about the libc-commits mailing list