mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-02 04:15:46 +00: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:
parent
c1024416f4
commit
04d267d347
@ -146,7 +146,6 @@ VIR_ONCE_GLOBAL_INIT(qemuAgent);
|
|||||||
|
|
||||||
|
|
||||||
#if DEBUG_RAW_IO
|
#if DEBUG_RAW_IO
|
||||||
# include <c-ctype.h>
|
|
||||||
static char *
|
static char *
|
||||||
qemuAgentEscapeNonPrintable(const char *text)
|
qemuAgentEscapeNonPrintable(const char *text)
|
||||||
{
|
{
|
||||||
@ -155,7 +154,7 @@ qemuAgentEscapeNonPrintable(const char *text)
|
|||||||
for (i = 0; text[i] != '\0'; i++) {
|
for (i = 0; text[i] != '\0'; i++) {
|
||||||
if (text[i] == '\\')
|
if (text[i] == '\\')
|
||||||
virBufferAddLit(&buf, "\\\\");
|
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'))
|
(text[i] == '\r' && text[i+1] == '\n'))
|
||||||
virBufferAddChar(&buf, text[i]);
|
virBufferAddChar(&buf, text[i]);
|
||||||
else
|
else
|
||||||
|
@ -199,14 +199,13 @@ VIR_ENUM_IMPL(qemuMonitorDumpStatus,
|
|||||||
|
|
||||||
|
|
||||||
#if DEBUG_RAW_IO
|
#if DEBUG_RAW_IO
|
||||||
# include <c-ctype.h>
|
|
||||||
static char *
|
static char *
|
||||||
qemuMonitorEscapeNonPrintable(const char *text)
|
qemuMonitorEscapeNonPrintable(const char *text)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
for (i = 0; text[i] != '\0'; i++) {
|
for (i = 0; text[i] != '\0'; i++) {
|
||||||
if (c_isprint(text[i]) ||
|
if (g_ascii_isprint(text[i]) ||
|
||||||
text[i] == '\n' ||
|
text[i] == '\n' ||
|
||||||
(text[i] == '\r' && text[i + 1] == '\n'))
|
(text[i] == '\r' && text[i + 1] == '\n'))
|
||||||
virBufferAddChar(&buf, text[i]);
|
virBufferAddChar(&buf, text[i]);
|
||||||
|
@ -1350,7 +1350,7 @@ virStringIsPrintable(const char *str)
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; str[i]; i++)
|
for (i = 0; str[i]; i++)
|
||||||
if (!c_isprint(str[i]))
|
if (!g_ascii_isprint(str[i]))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1369,7 +1369,7 @@ virStringBufferIsPrintable(const uint8_t *buf,
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < buflen; i++)
|
for (i = 0; i < buflen; i++)
|
||||||
if (!c_isprint(buf[i]))
|
if (!g_ascii_isprint(buf[i]))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
#include "c-ctype.h"
|
|
||||||
|
|
||||||
#include "viralloc.h"
|
#include "viralloc.h"
|
||||||
#include "virbuffer.h"
|
#include "virbuffer.h"
|
||||||
@ -244,7 +243,7 @@ vshTableSafeEncode(const char *s, size_t *width)
|
|||||||
* Not valid multibyte sequence -- maybe it's
|
* Not valid multibyte sequence -- maybe it's
|
||||||
* printable char according to the current locales.
|
* 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);
|
g_snprintf(buf, HEX_ENCODE_LENGTH + 1, "\\x%02x", *p);
|
||||||
buf += HEX_ENCODE_LENGTH;
|
buf += HEX_ENCODE_LENGTH;
|
||||||
*width += HEX_ENCODE_LENGTH;
|
*width += HEX_ENCODE_LENGTH;
|
||||||
|
Loading…
Reference in New Issue
Block a user