1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

use g_ascii_isprint instead of c_isprint from gnulib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Pavel Hrdina 2019-11-18 15:14:47 +01:00
parent c1024416f4
commit 04d267d347
4 changed files with 5 additions and 8 deletions

View File

@ -146,7 +146,6 @@ VIR_ONCE_GLOBAL_INIT(qemuAgent);
#if DEBUG_RAW_IO
# include <c-ctype.h>
static char *
qemuAgentEscapeNonPrintable(const char *text)
{
@ -155,7 +154,7 @@ qemuAgentEscapeNonPrintable(const char *text)
for (i = 0; text[i] != '\0'; i++) {
if (text[i] == '\\')
virBufferAddLit(&buf, "\\\\");
else if (c_isprint(text[i]) || text[i] == '\n' ||
else if (g_ascii_isprint(text[i]) || text[i] == '\n' ||
(text[i] == '\r' && text[i+1] == '\n'))
virBufferAddChar(&buf, text[i]);
else

View File

@ -199,14 +199,13 @@ VIR_ENUM_IMPL(qemuMonitorDumpStatus,
#if DEBUG_RAW_IO
# include <c-ctype.h>
static char *
qemuMonitorEscapeNonPrintable(const char *text)
{
size_t i;
virBuffer buf = VIR_BUFFER_INITIALIZER;
for (i = 0; text[i] != '\0'; i++) {
if (c_isprint(text[i]) ||
if (g_ascii_isprint(text[i]) ||
text[i] == '\n' ||
(text[i] == '\r' && text[i + 1] == '\n'))
virBufferAddChar(&buf, text[i]);

View File

@ -1350,7 +1350,7 @@ virStringIsPrintable(const char *str)
size_t i;
for (i = 0; str[i]; i++)
if (!c_isprint(str[i]))
if (!g_ascii_isprint(str[i]))
return false;
return true;
@ -1369,7 +1369,7 @@ virStringBufferIsPrintable(const uint8_t *buf,
size_t i;
for (i = 0; i < buflen; i++)
if (!c_isprint(buf[i]))
if (!g_ascii_isprint(buf[i]))
return false;
return true;

View File

@ -25,7 +25,6 @@
#include <stddef.h>
#include <wchar.h>
#include <wctype.h>
#include "c-ctype.h"
#include "viralloc.h"
#include "virbuffer.h"
@ -244,7 +243,7 @@ vshTableSafeEncode(const char *s, size_t *width)
* Not valid multibyte sequence -- maybe it's
* printable char according to the current locales.
*/
if (!c_isprint(*p)) {
if (!g_ascii_isprint(*p)) {
g_snprintf(buf, HEX_ENCODE_LENGTH + 1, "\\x%02x", *p);
buf += HEX_ENCODE_LENGTH;
*width += HEX_ENCODE_LENGTH;