[sysprof: 16/63] libsysprof-capture: Use fprintf() instead of g_printerr()



commit b6fb2728655ba837ccdd4545d74cc71d9cc032c0
Author: Philip Withnall <withnall endlessm com>
Date:   Wed Jul 1 16:55:03 2020 +0100

    libsysprof-capture: Use fprintf() instead of g_printerr()
    
    This removes one more dependency on GLib.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    Helps: #40

 src/libsysprof-capture/mapped-ring-buffer.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/libsysprof-capture/mapped-ring-buffer.c b/src/libsysprof-capture/mapped-ring-buffer.c
index fb1890b..1b0fff4 100644
--- a/src/libsysprof-capture/mapped-ring-buffer.c
+++ b/src/libsysprof-capture/mapped-ring-buffer.c
@@ -24,6 +24,7 @@
 
 #include <assert.h>
 #include <stdint.h>
+#include <stdio.h>
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -251,35 +252,35 @@ mapped_ring_buffer_new_writer (int fd)
   /* Make our own copy of the FD */
   if ((fd = dup (fd)) < 0)
     {
-      g_printerr ("Failed to dup() fd, cannot continue\n");
+      fprintf (stderr, "Failed to dup() fd, cannot continue\n");
       return NULL;
     }
 
   /* Seek to end to get buffer size */
   if ((buffer_size = lseek (fd, 0, SEEK_END)) < 0)
     {
-      g_printerr ("Failed to seek to end of file. Cannot determine buffer size.\n");
+      fprintf (stderr, "Failed to seek to end of file. Cannot determine buffer size.\n");
       return NULL;
     }
 
   /* Ensure non-zero sized buffer */
   if (buffer_size < (page_size + page_size))
     {
-      g_printerr ("Buffer is too small, cannot continue.\n");
+      fprintf (stderr, "Buffer is too small, cannot continue.\n");
       return NULL;
     }
 
   /* Make sure it is less than our max size */
   if ((buffer_size - page_size) > BUFFER_MAX_SIZE)
     {
-      g_printerr ("Buffer is too large, cannot continue.\n");
+      fprintf (stderr, "Buffer is too large, cannot continue.\n");
       return NULL;
     }
 
   /* Ensure we have page-aligned buffer */
   if ((buffer_size % page_size) != 0)
     {
-      g_printerr ("Invalid buffer size, not page aligned.\n");
+      fprintf (stderr, "Invalid buffer size, not page aligned.\n");
       return NULL;
     }
 


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