[PATCH v3 13/13] libvirt.c: add 2 spaces of indentation to example code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Claudio Bley <cbley@xxxxxxxxxx>
---
 src/libvirt.c |  114 ++++++++++++++++++++++++++++-----------------------------
 1 file changed, 57 insertions(+), 57 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index d9c4b6b..e287a3d 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -15716,37 +15716,37 @@ virStreamRef(virStreamPtr stream)
  * An example using this with a hypothetical file upload
  * API looks like
  *
- *   virStreamPtr st = virStreamNew(conn, 0);
- *   int fd = open("demo.iso", O_RDONLY)
+ *     virStreamPtr st = virStreamNew(conn, 0);
+ *     int fd = open("demo.iso", O_RDONLY)
  *
- *   virConnectUploadFile(conn, "demo.iso", st);
- *
- *   while (1) {
- *       char buf[1024];
- *       int got = read(fd, buf, 1024);
- *       if (got < 0) {
- *          virStreamAbort(st);
- *          break;
- *       }
- *       if (got == 0) {
- *          virStreamFinish(st);
- *          break;
- *       }
- *       int offset = 0;
- *       while (offset < got) {
- *          int sent = virStreamSend(st, buf+offset, got-offset)
- *          if (sent < 0) {
+ *     virConnectUploadFile(conn, "demo.iso", st);
+ *
+ *     while (1) {
+ *          char buf[1024];
+ *          int got = read(fd, buf, 1024);
+ *          if (got < 0) {
  *             virStreamAbort(st);
- *             goto done;
+ *             break;
  *          }
- *          offset += sent;
- *       }
- *   }
- *   if (virStreamFinish(st) < 0)
- *      ... report an error ....
- * done:
- *   virStreamFree(st);
- *   close(fd);
+ *          if (got == 0) {
+ *             virStreamFinish(st);
+ *             break;
+ *          }
+ *          int offset = 0;
+ *          while (offset < got) {
+ *             int sent = virStreamSend(st, buf+offset, got-offset)
+ *             if (sent < 0) {
+ *                virStreamAbort(st);
+ *                goto done;
+ *             }
+ *             offset += sent;
+ *          }
+ *      }
+ *      if (virStreamFinish(st) < 0)
+ *         ... report an error ....
+ *    done:
+ *      virStreamFree(st);
+ *      close(fd);
  *
  * Returns the number of bytes written, which may be less
  * than requested.
@@ -15810,35 +15810,35 @@ error:
  * An example using this with a hypothetical file download
  * API looks like
  *
- *   virStreamPtr st = virStreamNew(conn, 0);
- *   int fd = open("demo.iso", O_WRONLY, 0600)
- *
- *   virConnectDownloadFile(conn, "demo.iso", st);
- *
- *   while (1) {
- *       char buf[1024];
- *       int got = virStreamRecv(st, buf, 1024);
- *       if (got < 0)
- *          break;
- *       if (got == 0) {
- *          virStreamFinish(st);
- *          break;
- *       }
- *       int offset = 0;
- *       while (offset < got) {
- *          int sent = write(fd, buf+offset, got-offset)
- *          if (sent < 0) {
- *             virStreamAbort(st);
- *             goto done;
- *          }
- *          offset += sent;
- *       }
- *   }
- *   if (virStreamFinish(st) < 0)
- *      ... report an error ....
- * done:
- *   virStreamFree(st);
- *   close(fd);
+ *     virStreamPtr st = virStreamNew(conn, 0);
+ *     int fd = open("demo.iso", O_WRONLY, 0600)
+ *
+ *     virConnectDownloadFile(conn, "demo.iso", st);
+ *
+ *     while (1) {
+ *         char buf[1024];
+ *         int got = virStreamRecv(st, buf, 1024);
+ *         if (got < 0)
+ *            break;
+ *         if (got == 0) {
+ *            virStreamFinish(st);
+ *            break;
+ *         }
+ *         int offset = 0;
+ *         while (offset < got) {
+ *            int sent = write(fd, buf+offset, got-offset)
+ *            if (sent < 0) {
+ *               virStreamAbort(st);
+ *               goto done;
+ *            }
+ *            offset += sent;
+ *         }
+ *     }
+ *     if (virStreamFinish(st) < 0)
+ *        ... report an error ....
+ *   done:
+ *     virStreamFree(st);
+ *     close(fd);
  *
  *
  * Returns the number of bytes read, which may be less
-- 
1.7.9.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]