The "permitted_state_text" helper function can already fold its output in
a certain way, but that's only right for the "generate_docs_nbd_pod"
function; i.e., for the "HANDLE STATE" sections of the generated API docs.
Therefore, preserve both the folding and non-folding modes of
"permitted_state_text", but when we call it (in non-folding mode) from
"print_wrapper", apply the previously introduced "pr_wrap_cstr" to
the
result.
The effect on the generated output is [lib/api.c]:
 @@ -6522,7 +6522,8 @@ get_uri_in_permitted_state (struct nbd_h
      set_error (nbd_internal_is_state_created (state) ? ENOTCONN : EINVAL,
                 "invalid state: %s: the handle must be %s",
                 nbd_internal_state_short_string (state),
 -               "connecting, or negotiating, or connected with the server, or shut
down, or dead");
 +               "connecting, or negotiating, or connected with the server, "
 +               "or shut down, or dead");
      return false;
    }
    return true; 
Bugzilla: 
https://bugzilla.redhat.com/show_bug.cgi?id=2172516
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
 generator/C.ml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/generator/C.ml b/generator/C.ml
index f7a306de39d8..17b22d84d07d 100644
--- a/generator/C.ml
+++ b/generator/C.ml
@@ -551,7 +551,9 @@ let
       pr "    set_error (nbd_internal_is_state_created (state) ? ENOTCONN :
EINVAL,\n";
       pr "               \"invalid state: %%s: the handle must be
%%s\",\n";
       pr "               nbd_internal_state_short_string (state),\n";
-      pr "               \"%s\");\n" (permitted_state_text
permitted_states);
+      pr "               \"";
+      pr_wrap_cstr (fun () -> pr "%s" (permitted_state_text
permitted_states));
+      pr "\");\n";
       pr "    return false;\n";
       pr "  }\n";
       pr "  return true;\n";