]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
gnu: add binding for 'relocate' APIs
authorReuben Thomas <rrt@sc3d.org>
Fri, 19 Apr 2024 15:49:08 +0000 (17:49 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 29 May 2024 08:17:49 +0000 (10:17 +0200)
vapi/gnu.vapi

index beaa228cf51bc0034e0df2c4c384a9a4af01bd27..fea6371ae34673f370535d37ee708151e85cf343 100644 (file)
@@ -70,4 +70,25 @@ namespace Gnu {
 
        [CCode (cheader_filename = "quote.h")]
        public string quote (string arg);
+
+       [CCode (cheader_filename = "relocatable.h", cname = "relocate", type ="const char*")]
+       char* _gnulib_relocate (char* path);
+       [CCode (cname = "_vala_gnulib_relocate")]
+       public string relocate (string path) {
+               char* newpath = _gnulib_relocate (path);
+               if (newpath != path) {
+                       // If relocate malloced, then return the value, defeating Vala's
+                       // attempt to strdup it.
+                       return (string) (owned) newpath;
+               } else {
+                       // Otherwise, allow Vala to strdup the non-malloced return value.
+                       return (string) newpath;
+               }
+       }
+
+       [CCode (cheader_filename = "relocatable.h")]
+       public void set_relocation_prefix (string orig_prefix, string curr_prefix);
+
+       [CCode (cheader_filename = "relocatable.h")]
+       public string compute_curr_prefix (string orig_installprefix, string orig_installdir, string curr_pathname);
 }