qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] QOM: little improvements to object_resolve_path*()
@ 2024-10-02  8:08 marcandre.lureau
  2024-10-02  8:08 ` [PATCH 1/3] qom: rename object_resolve_path_type() "ambiguousp" marcandre.lureau
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: marcandre.lureau @ 2024-10-02  8:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: armbru, Eduardo Habkost, Paolo Bonzini, Daniel P. Berrangé,
	Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Hi,

Some improvements suggested by Markus during the review of "[PATCH v3 21/22]
qom/object: fix -Werror=maybe-uninitialized".

Marc-André Lureau (3):
  qom: rename object_resolve_path_type() "ambiguousp"
  qom: set *ambiguous on all paths
  qom: update object_resolve_path*() documentation

 include/qom/object.h | 12 ++++++------
 qom/object.c         | 13 ++++++++-----
 2 files changed, 14 insertions(+), 11 deletions(-)

-- 
2.45.2.827.g557ae147e6



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] qom: rename object_resolve_path_type() "ambiguousp"
  2024-10-02  8:08 [PATCH 0/3] QOM: little improvements to object_resolve_path*() marcandre.lureau
@ 2024-10-02  8:08 ` marcandre.lureau
  2024-10-02  8:08 ` [PATCH 2/3] qom: set *ambiguous on all paths marcandre.lureau
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: marcandre.lureau @ 2024-10-02  8:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: armbru, Eduardo Habkost, Paolo Bonzini, Daniel P. Berrangé,
	Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Make it match the function declaration & documentation.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qom/object.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/qom/object.c b/qom/object.c
index 28c5b66eab..0adbef2946 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -2184,7 +2184,7 @@ static Object *object_resolve_partial_path(Object *parent,
 }
 
 Object *object_resolve_path_type(const char *path, const char *typename,
-                                 bool *ambiguousp)
+                                 bool *ambiguous)
 {
     Object *obj;
     char **parts;
@@ -2193,11 +2193,11 @@ Object *object_resolve_path_type(const char *path, const char *typename,
     assert(parts);
 
     if (parts[0] == NULL || strcmp(parts[0], "") != 0) {
-        bool ambiguous = false;
+        bool ambig = false;
         obj = object_resolve_partial_path(object_get_root(), parts,
-                                          typename, &ambiguous);
-        if (ambiguousp) {
-            *ambiguousp = ambiguous;
+                                          typename, &ambig);
+        if (ambiguous) {
+            *ambiguous = ambig;
         }
     } else {
         obj = object_resolve_abs_path(object_get_root(), parts + 1, typename);
-- 
2.45.2.827.g557ae147e6



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] qom: set *ambiguous on all paths
  2024-10-02  8:08 [PATCH 0/3] QOM: little improvements to object_resolve_path*() marcandre.lureau
  2024-10-02  8:08 ` [PATCH 1/3] qom: rename object_resolve_path_type() "ambiguousp" marcandre.lureau
@ 2024-10-02  8:08 ` marcandre.lureau
  2024-10-02  8:08 ` [PATCH 3/3] qom: update object_resolve_path*() documentation marcandre.lureau
  2024-10-02 11:10 ` [PATCH 0/3] QOM: little improvements to object_resolve_path*() Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: marcandre.lureau @ 2024-10-02  8:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: armbru, Eduardo Habkost, Paolo Bonzini, Daniel P. Berrangé,
	Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

So the caller contract is simpler.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qom/object.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/qom/object.c b/qom/object.c
index 0adbef2946..222804dcfb 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -2201,6 +2201,9 @@ Object *object_resolve_path_type(const char *path, const char *typename,
         }
     } else {
         obj = object_resolve_abs_path(object_get_root(), parts + 1, typename);
+        if (ambiguous) {
+            *ambiguous = false;
+        }
     }
 
     g_strfreev(parts);
-- 
2.45.2.827.g557ae147e6



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] qom: update object_resolve_path*() documentation
  2024-10-02  8:08 [PATCH 0/3] QOM: little improvements to object_resolve_path*() marcandre.lureau
  2024-10-02  8:08 ` [PATCH 1/3] qom: rename object_resolve_path_type() "ambiguousp" marcandre.lureau
  2024-10-02  8:08 ` [PATCH 2/3] qom: set *ambiguous on all paths marcandre.lureau
@ 2024-10-02  8:08 ` marcandre.lureau
  2024-10-02 11:10 ` [PATCH 0/3] QOM: little improvements to object_resolve_path*() Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: marcandre.lureau @ 2024-10-02  8:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: armbru, Eduardo Habkost, Paolo Bonzini, Daniel P. Berrangé,
	Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

- update doc to reflect that @ambiguous is now set true or false on failure
- specify that @ambiguous is nullable
- use some gtk-doc annotations

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/qom/object.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/qom/object.h b/include/qom/object.h
index 13d3a655dd..2af9854675 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -1569,8 +1569,8 @@ char *object_get_canonical_path(const Object *obj);
 /**
  * object_resolve_path:
  * @path: the path to resolve
- * @ambiguous: returns true if the path resolution failed because of an
- *   ambiguous match
+ * @ambiguous: (out) (optional): location to store whether the lookup failed
+ *   because it was ambiguous, or %NULL. Set to %false on success.
  *
  * There are two types of supported paths--absolute paths and partial paths.
  * 
@@ -1587,7 +1587,7 @@ char *object_get_canonical_path(const Object *obj);
  * only one match is found.  If more than one match is found, a flag is
  * returned to indicate that the match was ambiguous.
  *
- * Returns: The matched object or NULL on path lookup failure.
+ * Returns: The matched object or %NULL on path lookup failure.
  */
 Object *object_resolve_path(const char *path, bool *ambiguous);
 
@@ -1595,10 +1595,10 @@ Object *object_resolve_path(const char *path, bool *ambiguous);
  * object_resolve_path_type:
  * @path: the path to resolve
  * @typename: the type to look for.
- * @ambiguous: returns true if the path resolution failed because of an
- *   ambiguous match
+ * @ambiguous: (out) (optional): location to store whether the lookup failed
+ *   because it was ambiguous, or %NULL. Set to %false on success.
  *
- * This is similar to object_resolve_path.  However, when looking for a
+ * This is similar to object_resolve_path().  However, when looking for a
  * partial path only matches that implement the given type are considered.
  * This restricts the search and avoids spuriously flagging matches as
  * ambiguous.
-- 
2.45.2.827.g557ae147e6



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] QOM: little improvements to object_resolve_path*()
  2024-10-02  8:08 [PATCH 0/3] QOM: little improvements to object_resolve_path*() marcandre.lureau
                   ` (2 preceding siblings ...)
  2024-10-02  8:08 ` [PATCH 3/3] qom: update object_resolve_path*() documentation marcandre.lureau
@ 2024-10-02 11:10 ` Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2024-10-02 11:10 UTC (permalink / raw)
  To: marcandre.lureau
  Cc: qemu-devel, armbru, Eduardo Habkost, Daniel P . Berrangé

Queued, thanks.

Paolo



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-02 11:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-02  8:08 [PATCH 0/3] QOM: little improvements to object_resolve_path*() marcandre.lureau
2024-10-02  8:08 ` [PATCH 1/3] qom: rename object_resolve_path_type() "ambiguousp" marcandre.lureau
2024-10-02  8:08 ` [PATCH 2/3] qom: set *ambiguous on all paths marcandre.lureau
2024-10-02  8:08 ` [PATCH 3/3] qom: update object_resolve_path*() documentation marcandre.lureau
2024-10-02 11:10 ` [PATCH 0/3] QOM: little improvements to object_resolve_path*() Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).