search for: rconstoptstring

Displaying 20 results from an estimated 72 matches for "rconstoptstring".

2012 Jan 25
2
[PATCH 1/2] gobject: Allow RConstOptString to return an error
RConstOptString cannot return an error in the C api. This makes it a special case for the GObject api, as all other return types have a corresponding GError **err argument to return an error. This change removes this special case, and includes the possibility of an error return in the API. An error is indicated by...
2009 Sep 24
1
[PATCH libguestfs] maint: use spaces, not TABs for indentation
...quot;; pr " }\n"; @@ -4759,16 +4759,16 @@ check_state (guestfs_h *g, const char *caller) pr " guestfs_message_header hdr;\n"; pr " guestfs_message_error err;\n"; let has_ret = - match fst style with - | RErr -> false - | RConstString _ | RConstOptString _ -> + match fst style with + | RErr -> false + | RConstString _ | RConstOptString _ -> failwithf "RConstString|RConstOptString cannot be used by daemon functions" - | RInt _ | RInt64 _ - | RBool _ | RString _ | RStringList _ - | RStruct _ | RStr...
2017 Apr 25
0
[PATCH] daemon: Use CLEANUP_* functions to avoid an explicit free in stub functions.
...+), 13 deletions(-) diff --git a/generator/daemon.ml b/generator/daemon.ml index b00627063..9d5ba00b2 100644 --- a/generator/daemon.ml +++ b/generator/daemon.ml @@ -155,13 +155,13 @@ let generate_daemon_stubs actions () = | RBool _ -> pr " int r;\n" | RConstString _ | RConstOptString _ -> failwithf "RConstString|RConstOptString cannot be used by daemon functions" - | RString _ -> pr " char *r;\n" - | RStringList _ | RHashtable _ -> pr " char **r;\n" - | RStruct (_, typ) -> pr " guestfs_int_%s *r;\n&...
2019 Jun 27
0
[PATCH 7/9] Rust bindings: Complete actions
...); + if optargs <> [] then + pr ", optarg: *const RawOptArgs%s" cname; + + pr ") -> "; + + (match ret with + | RErr | RInt _ | RBool _ -> pr "c_int" + | RInt64 _ -> pr "i64" + | RConstString _ | RString _ | RConstOptString _ -> pr "*const c_char" + | RBufferOut _ -> pr "*const u8" + | RStringList _ | RHashtable _-> pr "*const *const c_char" + | RStruct (_, n) -> + let n = camel_name_of_struct n in + pr "*const Raw%s" n + | RStructL...
2020 Jul 06
2
[PATCH] python: Add type hints
...fun f -> let ret, args, optargs = f.style in let len_name = String.length f.name in + let ret_type_hint = + match ret with + | RErr -> "None" + | RInt _ | RInt64 _ -> "int" + | RBool _ -> "bool" + | RConstOptString _ -> "Optional[str]" + | RConstString _ | RString _ -> "str" + | RBufferOut _ -> "bytes" + | RStringList _ -> "List[str]" + | RStruct _ -> "dict" + | RStructList _ -> "List[dict]" +...
2020 Feb 19
1
[PATCH] golang: make API idiomatic so that functions return (<val>, error)
..."0, " + | RInt64 _ -> pr " (int64, error)"; "0, " + | RBool _ -> pr " (bool, error)"; "false, " | RConstString _ - | RString _ -> pr " (string, *GuestfsError)"; "\"\", " - | RConstOptString _ -> pr " (*string, *GuestfsError)"; "nil, " - | RStringList _ -> pr " ([]string, *GuestfsError)"; "nil, " + | RString _ -> pr " (string, error)"; "\"\", " + | RConstOptString _ -> pr " (*str...
2009 Aug 03
1
[PATCH 1/2] Convert all TABs-as-indentation to spaces.
...uot; || n = "args" then + failwithf "%s has a param/ret called 'argv' or 'args', which will cause some conflicts in the generated code" name in (match fst style with @@ -3820,7 +3820,7 @@ let check_functions () = | RConstString n | RConstOptString n | RString n | RStringList n | RStruct (n, _) | RStructList (n, _) | RHashtable n | RBufferOut n -> - check_arg_ret_name n + check_arg_ret_name n ); List.iter (fun arg -> check_arg_ret_name (name_of_argt arg)) (snd style) ) all_functions; @@ -382...
2012 Jan 17
3
GObject bindings
This is the first iteration of the GObject bindings. I have 'kicked the tyres' on these, meaning I have ensured that a bunch of basic manual tests work as expected. I'm in the process of adding more comprehensive tests. Here's an example simple javascript program which uses these bindings: === const Guestfs = imports.gi.Guestfs; print('Starting'); var g = new
2009 Nov 19
1
[PATCH libguestfs] syntax-check: expand TABs in generator.ml
...n"; pr " *size_r = ret.%s.%s_len;\n" n n; pr " return p;\n"; - pr " }\n"; + pr " }\n"; ); pr "}\n\n" @@ -5592,18 +5592,18 @@ and generate_daemon_actions () = | RConstString _ | RConstOptString _ | RString _ | RStringList _ | RHashtable _ | RStruct (_, _) | RStructList (_, _) -> - pr " if (r == %s)\n" error_code; - pr " /* do_%s has already called reply_with_error */\n" name; - pr " goto done;\n"; - pr "\n" +...
2017 May 04
4
[PATCH 0/3] generator: Allow returned strings to be annotated as devices.
If we want to permit more than 255 drives to be added, then we will have to add the disks to the same virtio-scsi target using different unit (LUN) numbers. Unfortunately SCSI LUN enumeration in the Linux is not deterministic (eg. two disks with target=0, lun=[0,1] can be enumerated as /dev/sda or /dev/sdb randomly). Dealing with that will require some very complex device name translation on the
2012 Jan 16
1
[PATCH] generator: Add an explicit Cancellable flag
Currently any api which takes a FileIn or FileOut parameter is implicitly cancellable. This change make cancellable an explicit flag in anticipation of it being added to other apis. --- generator/generator_actions.ml | 53 ++++++++++++++++++++++++++------------- generator/generator_checks.ml | 3 +- generator/generator_types.ml | 1 + 3 files changed, 38 insertions(+), 19 deletions(-)
2012 Jan 20
11
[PATCH 01/10] Revert "Revert "generator: Add CamelName flag""
...failwithf "%s: camel case name must contains uppercase characters" name n; + if String.contains n '_' then + failwithf "%s: camel case name must not contain '_'" name n; | Cancellable -> (match ret with | RConstOptString n -> diff --git a/generator/generator_types.ml b/generator/generator_types.ml index d690377..233be54 100644 --- a/generator/generator_types.ml +++ b/generator/generator_types.ml @@ -222,6 +222,9 @@ type flags = | DeprecatedBy of string (* function is deprecated, use .. instead *) | Optiona...
2012 Jul 14
6
[PATCH 0/6] Allow non-optargs functions to gain optional arguments.
This rather complex set of patches allow non-optargs functions to gain optional arguments, while preserving source and binary backwards compatibility. The problem is that we cannot add an optional argument to an existing function. For example, we might want to add flags to the 'lvresize' API which currently has no optional arguments.
2020 Jul 06
0
Re: [PATCH] python: Add type hints
...gs, optargs = f.style in > let len_name = String.length f.name in > + let ret_type_hint = > + match ret with > + | RErr -> "None" > + | RInt _ | RInt64 _ -> "int" > + | RBool _ -> "bool" > + | RConstOptString _ -> "Optional[str]" > + | RConstString _ | RString _ -> "str" > + | RBufferOut _ -> "bytes" > + | RStringList _ -> "List[str]" > + | RStruct _ -> "dict" > + | RStructList _ -> &quo...
2011 Mar 07
1
[PATCH] Fix trace segfault for non-daemon functions (RHBZ#682756).
...shortname style; pr "{\n"; pr " int trace_flag = g->trace;\n"; - (match ret with - | RErr | RInt _ | RBool _ -> - pr " int r;\n" - | RInt64 _ -> - pr " int64_t r;\n" - | RConstString _ | RConstOptString _ -> - pr " const char *r;\n" - | RString _ | RBufferOut _ -> - pr " char *r;\n" - | RStringList _ | RHashtable _ -> - pr " char **r;\n" - | RStruct (_, typ) -> - pr " struct guestfs_%s *r;\...
2015 Feb 14
0
[PATCH] python: Call PyErr_Clear() on non-error paths out of the Python bindings.
...pr " py_r = PyString_FromString (r);\n"; pr "#else\n"; pr " py_r = PyUnicode_FromString (r);\n"; - pr "#endif\n" + pr "#endif\n"; + pr " if (py_r == NULL) goto out;\n"; | RConstOptString _ -> pr " if (r) {\n"; pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; @@ -466,14 +467,16 @@ put_table (char * const * const argv) pr " } else {\n"; pr " Py_INCREF (Py_None);\n"; pr " py_r = Py...
2017 May 09
1
[PATCH v2] python: add simple wrappers for PyObject<->string functions
...mString (r);\n"; - pr "#else\n"; - pr " py_r = PyUnicode_FromString (r);\n"; - pr "#endif\n"; + pr " py_r = guestfs_int_py_fromstring (r);\n"; pr " if (py_r == NULL) goto out;\n"; | RConstOptString _ -> pr " if (r) {\n"; - pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; - pr " py_r = PyString_FromString (r);\n"; - pr "#else\n"; - pr " py_r = PyUnicode_FromString (r);\n"; - pr "...
2012 Jan 20
2
GObject bindings overview
...this to the appropriate error mechanism for each target language. RErr returns a gboolean, true = success, false = failure. The following types return the value from libguestfs unchanged: RInt RInt64 RBool RConstString (transfer none): gobject doesn't manage returned memory RConstOptString (transfer none). Methods don't return an error (no GError**) RString RStringList RHashtable is converted to a GHashTable. The keys and values from libguestfs are inserted directly into the GHashTable without copying. The top level array returned by libguestfs is freed. RStruct is con...
2016 Feb 15
1
[PATCH] Start adding return values tests for bindings
..._fail('internal_test_rbool', v); -check_error('internal_test_rboolerr'); - -v = g.internal_test_rconststring('1'); -v == 'static string' || eq_fail('internal_test_rconststring', v); -check_error('internal_test_rconststringerr'); - -v = g.internal_test_rconstoptstring('1'); -v == 'static string' || eq_fail('internal_test_rconstoptstring', v); -//check_error('internal_test_rconstoptstringerr'); - -v = g.internal_test_rstring('string'); -v == 'string' || eq_fail('internal_test_rstring', v); -check_error('...
2016 Apr 11
1
[PATCH] RFC: php: support PHP 7
...ot; }\n"; @@ -499,23 +546,23 @@ PHP_FUNCTION (guestfs_last_error) | RInt64 _ -> pr " RETURN_LONG (r);\n" | RConstString _ -> - pr " RETURN_STRING (r, 1);\n" + pr " GUESTFS_RETURN_STRING (r, 1);\n" | RConstOptString _ -> - pr " if (r) { RETURN_STRING (r, 1); }\n"; + pr " if (r) { GUESTFS_RETURN_STRING (r, 1); }\n"; pr " else { RETURN_NULL (); }\n" | RString _ -> pr " char *r_copy = estrdup (r);\n";...