trivial patches for 2014-12-11

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJUid7mAAoJEL7lnXSkw9fbX0YH/RXeoX7IN1QVEP8Z2dLq4nzt
 igHm4Gd4ENX6pdluHmXAxzKoHR78yNGFegzuv0IJBfav8kGCQWW6zAf4TUk/udtn
 AKPk1yauVKNzCvmYldrfbuu4HedZqkftE0tyDZuAK50pZH1hzX7qiAT1C0OlarLQ
 Tqy4+ouYiRja2hLq4YJCM9mmYt0sbMDShIcHBYRTdD0cxoPZ+JZEeAQYg+FYNdIo
 jioVg8NgmFZW37UWeBTCKG+DcX9NwXwyo/ASdIozM+aQcTBx/nXn7/NOAxXlxUX8
 M9AS9iz+LWBfwof3HLbzLLTvTmE66Z78/TluFMmEbpK4ts0ZXRJKDHE/pfynRD0=
 =PXlQ
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2014-12-11' into staging

trivial patches for 2014-12-11

# gpg: Signature made Thu 11 Dec 2014 18:13:58 GMT using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"

* remotes/mjt/tags/pull-trivial-patches-2014-12-11:
  Sort include/qemu/typedefs.h
  hpet: increase spelling precision
  pflash_cfi02.c: associate "cfi.pflash02" to "Storage devices" category
  vt82c686: fix coverity warning about out-of-bounds write
  virtio: remove useless declaration of virtio_net_init()
  qapi-schema: fix typo about change-vnc-password
  fw_cfg: remove superfluous blank line
  get_maintainer.pl: Remove the --git-chief-penguins option
  configure: Replace which(1) with "has"
  util: Use g_new() & friends where that makes obvious sense
  util: Fuse g_malloc(); memset() into g_new0()
  util: Drop superfluous conditionals around g_free()
  Drop superfluous conditionals around g_strdup()
  Drop superfluous conditionals around qemu_opts_del()
  usb: delete redundant brackets in usb_host_handle_control()
  virtio-bus: avoid breaking build when open DEBUG switch
  acpi-build: Make DPRINTF working for acpi-build
  acpi-build: adjust indention 8 -> 4 spaces
  target-s390x: fix possible out of bounds read
  qmp: fix typo in input-send-event examples

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-12-11 18:27:02 +00:00
commit 99c9c3cb24
21 changed files with 143 additions and 215 deletions

View File

@ -88,11 +88,7 @@ static char *rng_random_get_filename(Object *obj, Error **errp)
{
RndRandom *s = RNG_RANDOM(obj);
if (s->filename) {
return g_strdup(s->filename);
}
return NULL;
return g_strdup(s->filename);
}
static void rng_random_set_filename(Object *obj, const char *filename,

2
configure vendored
View File

@ -2727,7 +2727,7 @@ fi
if test "$modules" = yes; then
shacmd_probe="sha1sum sha1 shasum"
for c in $shacmd_probe; do
if which $c >/dev/null 2>&1; then
if has $c; then
shacmd="$c"
break
fi

View File

@ -744,6 +744,7 @@ static void pflash_cfi02_class_init(ObjectClass *klass, void *data)
dc->realize = pflash_cfi02_realize;
dc->props = pflash_cfi02_properties;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
static const TypeInfo pflash_cfi02_info = {

View File

@ -1141,9 +1141,7 @@ static void device_finalize(Object *obj)
NamedGPIOList *ngl, *next;
DeviceState *dev = DEVICE(obj);
if (dev->opts) {
qemu_opts_del(dev->opts);
}
qemu_opts_del(dev->opts);
QLIST_FOREACH_SAFE(ngl, &dev->gpios, node, next) {
QLIST_REMOVE(ngl, node);

View File

@ -68,6 +68,14 @@
#define ACPI_BUILD_TABLE_SIZE 0x20000
/* #define DEBUG_ACPI_BUILD */
#ifdef DEBUG_ACPI_BUILD
#define ACPI_BUILD_DPRINTF(fmt, ...) \
do {printf("ACPI_BUILD: " fmt, ## __VA_ARGS__); } while (0)
#else
#define ACPI_BUILD_DPRINTF(fmt, ...)
#endif
typedef struct AcpiCpuInfo {
DECLARE_BITMAP(found_cpus, ACPI_CPU_HOTPLUG_ID_LIMIT);
} AcpiCpuInfo;
@ -246,8 +254,6 @@ static void acpi_get_pci_info(PcPciInfo *info)
#define ACPI_BUILD_APPNAME6 "BOCHS "
#define ACPI_BUILD_APPNAME4 "BXPC"
#define ACPI_BUILD_DPRINTF(level, fmt, ...) do {} while (0)
#define ACPI_BUILD_TABLE_FILE "etc/acpi/tables"
#define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp"
#define ACPI_BUILD_TPMLOG_FILE "etc/tpm/log"
@ -273,12 +279,12 @@ build_header(GArray *linker, GArray *table_data,
static inline GArray *build_alloc_array(void)
{
return g_array_new(false, true /* clear */, 1);
return g_array_new(false, true /* clear */, 1);
}
static inline void build_free_array(GArray *array)
{
g_array_free(array, true);
g_array_free(array, true);
}
static inline void build_prepend_byte(GArray *array, uint8_t val)
@ -1569,7 +1575,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
table_offsets = g_array_new(false, true /* clear */,
sizeof(uint32_t));
ACPI_BUILD_DPRINTF(3, "init ACPI tables\n");
ACPI_BUILD_DPRINTF("init ACPI tables\n");
bios_linker_loader_alloc(tables->linker, ACPI_BUILD_TABLE_FILE,
64 /* Ensure FACS is aligned */,
@ -1750,17 +1756,17 @@ void acpi_setup(PcGuestInfo *guest_info)
AcpiBuildState *build_state;
if (!guest_info->fw_cfg) {
ACPI_BUILD_DPRINTF(3, "No fw cfg. Bailing out.\n");
ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n");
return;
}
if (!guest_info->has_acpi_build) {
ACPI_BUILD_DPRINTF(3, "ACPI build disabled. Bailing out.\n");
ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n");
return;
}
if (!acpi_enabled) {
ACPI_BUILD_DPRINTF(3, "ACPI disabled. Bailing out.\n");
ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n");
return;
}

View File

@ -50,13 +50,13 @@ typedef struct VT82C686BState {
static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data,
unsigned size)
{
int can_write;
SuperIOConfig *superio_conf = opaque;
DPRINTF("superio_ioport_writeb address 0x%x val 0x%x\n", addr, data);
if (addr == 0x3f0) {
superio_conf->index = data & 0xff;
} else {
bool can_write = true;
/* 0x3f1 */
switch (superio_conf->index) {
case 0x00 ... 0xdf:
@ -68,30 +68,27 @@ static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data,
case 0xf7:
case 0xf9 ... 0xfb:
case 0xfd ... 0xff:
can_write = 0;
can_write = false;
break;
case 0xe7:
if ((data & 0xff) != 0xfe) {
DPRINTF("change uart 1 base. unsupported yet\n");
can_write = false;
}
break;
case 0xe8:
if ((data & 0xff) != 0xbe) {
DPRINTF("change uart 2 base. unsupported yet\n");
can_write = false;
}
break;
default:
can_write = 1;
break;
if (can_write) {
switch (superio_conf->index) {
case 0xe7:
if ((data & 0xff) != 0xfe) {
DPRINTF("chage uart 1 base. unsupported yet\n");
}
break;
case 0xe8:
if ((data & 0xff) != 0xbe) {
DPRINTF("chage uart 2 base. unsupported yet\n");
}
break;
default:
superio_conf->config[superio_conf->index] = data & 0xff;
}
}
}
superio_conf->config[superio_conf->index] = data & 0xff;
if (can_write) {
superio_conf->config[superio_conf->index] = data & 0xff;
}
}
}

View File

@ -621,7 +621,6 @@ static void fw_cfg_realize(DeviceState *dev, Error **errp)
FWCfgState *s = FW_CFG(dev);
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
if (s->ctl_iobase + 1 == s->data_iobase) {
sysbus_add_io(sbd, s->ctl_iobase, &s->comb_iomem);
} else {

View File

@ -1,5 +1,5 @@
/*
* High Precisition Event Timer emulation
* High Precision Event Timer emulation
*
* Copyright (c) 2007 Alexander Graf
* Copyright (c) 2008 IBM Corporation

View File

@ -400,9 +400,7 @@ static int tpm_passthrough_handle_device_opts(QemuOpts *opts, TPMBackend *tb)
const char *value;
value = qemu_opt_get(opts, "cancel-path");
if (value) {
tb->cancel_path = g_strdup(value);
}
tb->cancel_path = g_strdup(value);
value = qemu_opt_get(opts, "path");
if (!value) {

View File

@ -1237,7 +1237,7 @@ static void usb_host_handle_control(USBDevice *udev, USBPacket *p,
/* Fix up USB-3 ep0 maxpacket size to allow superspeed connected devices
* to work redirected to a not superspeed capable hcd */
if (udev->speed == USB_SPEED_SUPER &&
!((udev->port->speedmask & USB_SPEED_MASK_SUPER)) &&
!(udev->port->speedmask & USB_SPEED_MASK_SUPER) &&
request == 0x8006 && value == 0x100 && index == 0) {
r->usb3ep0quirk = true;
}

View File

@ -58,7 +58,7 @@ void virtio_bus_reset(VirtioBusState *bus)
{
VirtIODevice *vdev = virtio_bus_get_device(bus);
DPRINTF("%s: reset device.\n", qbus->name);
DPRINTF("%s: reset device.\n", BUS(bus)->name);
if (vdev != NULL) {
virtio_reset(vdev);
}

View File

@ -230,9 +230,6 @@ int virtio_set_features(VirtIODevice *vdev, uint32_t val);
/* Base devices. */
typedef struct VirtIOBlkConf VirtIOBlkConf;
struct virtio_net_conf;
VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf,
struct virtio_net_conf *net,
uint32_t host_features);
typedef struct virtio_serial_conf virtio_serial_conf;
typedef struct VirtIOSCSIConf VirtIOSCSIConf;
typedef struct VirtIORNGConf VirtIORNGConf;

View File

@ -3,80 +3,75 @@
/* A load of opaque types so that device init declarations don't have to
pull in all the real definitions. */
typedef struct QEMUTimer QEMUTimer;
typedef struct QEMUTimerListGroup QEMUTimerListGroup;
typedef struct QEMUFile QEMUFile;
typedef struct QEMUBH QEMUBH;
typedef struct AioContext AioContext;
typedef struct Visitor Visitor;
struct Monitor;
typedef struct Monitor Monitor;
typedef struct MigrationParams MigrationParams;
typedef struct Property Property;
typedef struct PropertyInfo PropertyInfo;
typedef struct CompatProperty CompatProperty;
typedef struct DeviceState DeviceState;
typedef struct BusState BusState;
typedef struct BusClass BusClass;
/* Please keep this list in alphabetical order */
typedef struct AdapterInfo AdapterInfo;
typedef struct AddressSpace AddressSpace;
typedef struct MemoryRegion MemoryRegion;
typedef struct MemoryRegionSection MemoryRegionSection;
typedef struct MemoryListener MemoryListener;
typedef struct MemoryMappingList MemoryMappingList;
typedef struct QEMUMachine QEMUMachine;
typedef struct MachineClass MachineClass;
typedef struct MachineState MachineState;
typedef struct NICInfo NICInfo;
typedef struct HCIInfo HCIInfo;
typedef struct AioContext AioContext;
typedef struct AudioState AudioState;
typedef struct BlockBackend BlockBackend;
typedef struct BlockDriverState BlockDriverState;
typedef struct DriveInfo DriveInfo;
typedef struct DisplayState DisplayState;
typedef struct DisplayChangeListener DisplayChangeListener;
typedef struct DisplaySurface DisplaySurface;
typedef struct PixelFormat PixelFormat;
typedef struct QemuConsole QemuConsole;
typedef struct BusClass BusClass;
typedef struct BusState BusState;
typedef struct CharDriverState CharDriverState;
typedef struct MACAddr MACAddr;
typedef struct NetClientState NetClientState;
typedef struct CompatProperty CompatProperty;
typedef struct DeviceState DeviceState;
typedef struct DisplayChangeListener DisplayChangeListener;
typedef struct DisplayState DisplayState;
typedef struct DisplaySurface DisplaySurface;
typedef struct DriveInfo DriveInfo;
typedef struct EventNotifier EventNotifier;
typedef struct FWCfgState FWCfgState;
typedef struct HCIInfo HCIInfo;
typedef struct I2CBus I2CBus;
typedef struct I2SCodec I2SCodec;
typedef struct ISABus ISABus;
typedef struct ISADevice ISADevice;
typedef struct SMBusDevice SMBusDevice;
typedef struct PCIHostState PCIHostState;
typedef struct PCIExpressHost PCIExpressHost;
typedef struct MACAddr MACAddr;
typedef struct MachineClass MachineClass;
typedef struct MachineState MachineState;
typedef struct MemoryListener MemoryListener;
typedef struct MemoryMappingList MemoryMappingList;
typedef struct MemoryRegion MemoryRegion;
typedef struct MemoryRegionSection MemoryRegionSection;
typedef struct MigrationParams MigrationParams;
typedef struct Monitor Monitor;
typedef struct MouseTransformInfo MouseTransformInfo;
typedef struct MSIMessage MSIMessage;
typedef struct NetClientState NetClientState;
typedef struct NICInfo NICInfo;
typedef struct PcGuestInfo PcGuestInfo;
typedef struct PCIBridge PCIBridge;
typedef struct PCIBus PCIBus;
typedef struct PCIDevice PCIDevice;
typedef struct PCIExpressDevice PCIExpressDevice;
typedef struct PCIBridge PCIBridge;
typedef struct PCIEAERMsg PCIEAERMsg;
typedef struct PCIEAERLog PCIEAERLog;
typedef struct PCIEAERErr PCIEAERErr;
typedef struct PCIEAERLog PCIEAERLog;
typedef struct PCIEAERMsg PCIEAERMsg;
typedef struct PCIEPort PCIEPort;
typedef struct PCIESlot PCIESlot;
typedef struct MSIMessage MSIMessage;
typedef struct SerialState SerialState;
typedef struct PCIExpressDevice PCIExpressDevice;
typedef struct PCIExpressHost PCIExpressHost;
typedef struct PCIHostState PCIHostState;
typedef struct PCMCIACardState PCMCIACardState;
typedef struct MouseTransformInfo MouseTransformInfo;
typedef struct uWireSlave uWireSlave;
typedef struct I2SCodec I2SCodec;
typedef struct SSIBus SSIBus;
typedef struct EventNotifier EventNotifier;
typedef struct VirtIODevice VirtIODevice;
typedef struct PixelFormat PixelFormat;
typedef struct PropertyInfo PropertyInfo;
typedef struct Property Property;
typedef struct QEMUBH QEMUBH;
typedef struct QemuConsole QemuConsole;
typedef struct QEMUFile QEMUFile;
typedef struct QEMUMachine QEMUMachine;
typedef struct QEMUSGList QEMUSGList;
typedef struct QEMUSizedBuffer QEMUSizedBuffer;
typedef struct SHPCDevice SHPCDevice;
typedef struct FWCfgState FWCfgState;
typedef struct PcGuestInfo PcGuestInfo;
typedef struct QEMUTimerListGroup QEMUTimerListGroup;
typedef struct QEMUTimer QEMUTimer;
typedef struct Range Range;
typedef struct AdapterInfo AdapterInfo;
typedef struct SerialState SerialState;
typedef struct SHPCDevice SHPCDevice;
typedef struct SMBusDevice SMBusDevice;
typedef struct SSIBus SSIBus;
typedef struct uWireSlave uWireSlave;
typedef struct VirtIODevice VirtIODevice;
typedef struct Visitor Visitor;
#endif /* QEMU_TYPEDEFS_H */

View File

@ -1533,7 +1533,7 @@
#
# Change the VNC server password.
#
# @target: the new password to use with VNC authentication
# @password: the new password to use with VNC authentication
#
# Since: 1.1
#

View File

@ -3825,9 +3825,7 @@ void qemu_chr_delete(CharDriverState *chr)
}
g_free(chr->filename);
g_free(chr->label);
if (chr->opts) {
qemu_opts_del(chr->opts);
}
qemu_opts_del(chr->opts);
g_free(chr);
}

View File

@ -3820,13 +3820,13 @@ Press left mouse button.
-> { "execute": "x-input-send-event",
"arguments": { "console": 0,
"events": [ { "type": "btn",
"data" : { "down": true, "button": "Left" } } } }
"data" : { "down": true, "button": "Left" } } ] } }
<- { "return": {} }
-> { "execute": "x-input-send-event",
"arguments": { "console": 0,
"events": [ { "type": "btn",
"data" : { "down": false, "button": "Left" } } } }
"data" : { "down": false, "button": "Left" } } ] } }
<- { "return": {} }
Example (2):

View File

@ -23,7 +23,6 @@ my $email_usename = 1;
my $email_maintainer = 1;
my $email_list = 1;
my $email_subscriber_list = 0;
my $email_git_penguin_chiefs = 0;
my $email_git = 0;
my $email_git_all_signature_types = 0;
my $email_git_blame = 0;
@ -60,21 +59,6 @@ my $exit = 0;
my %commit_author_hash;
my %commit_signer_hash;
my @penguin_chief = ();
push(@penguin_chief, "Linus Torvalds:torvalds\@linux-foundation.org");
#Andrew wants in on most everything - 2009/01/14
#push(@penguin_chief, "Andrew Morton:akpm\@linux-foundation.org");
my @penguin_chief_names = ();
foreach my $chief (@penguin_chief) {
if ($chief =~ m/^(.*):(.*)/) {
my $chief_name = $1;
my $chief_addr = $2;
push(@penguin_chief_names, $chief_name);
}
}
my $penguin_chiefs = "\(" . join("|", @penguin_chief_names) . "\)";
# Signature types of people who are either
# a) responsible for the code in question, or
# b) familiar enough with it to give relevant feedback
@ -187,7 +171,6 @@ if (!GetOptions(
'git-blame!' => \$email_git_blame,
'git-blame-signatures!' => \$email_git_blame_signatures,
'git-fallback!' => \$email_git_fallback,
'git-chief-penguins!' => \$email_git_penguin_chiefs,
'git-min-signatures=i' => \$email_git_min_signatures,
'git-max-maintainers=i' => \$email_git_max_maintainers,
'git-min-percent=i' => \$email_git_min_percent,
@ -256,7 +239,7 @@ if ($sections) {
if ($email &&
($email_maintainer + $email_list + $email_subscriber_list +
$email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) {
$email_git + $email_git_blame) == 0) {
die "$P: Please select at least 1 email option\n";
}
@ -671,19 +654,6 @@ sub get_maintainers {
}
}
foreach my $chief (@penguin_chief) {
if ($chief =~ m/^(.*):(.*)/) {
my $email_address;
$email_address = format_email($1, $2, $email_usename);
if ($email_git_penguin_chiefs) {
push(@email_to, [$email_address, 'chief penguin']);
} else {
@email_to = grep($_->[0] !~ /${email_address}/, @email_to);
}
}
}
foreach my $email (@file_emails) {
my ($name, $address) = parse_email($email);
@ -740,7 +710,6 @@ MAINTAINER field selection options:
--git-all-signature-types => include signers regardless of signature type
or use only ${signature_pattern} signers (default: $email_git_all_signature_types)
--git-fallback => use git when no exact MAINTAINERS pattern (default: $email_git_fallback)
--git-chief-penguins => include ${penguin_chiefs}
--git-min-signatures => number of signatures required (default: $email_git_min_signatures)
--git-max-maintainers => maximum maintainers to add (default: $email_git_max_maintainers)
--git-min-percent => minimum percentage of commits required (default: $email_git_min_percent)
@ -1281,10 +1250,6 @@ sub vcs_find_signers {
save_commits_by_author(@lines) if ($interactive);
save_commits_by_signer(@lines) if ($interactive);
if (!$email_git_penguin_chiefs) {
@signatures = grep(!/${penguin_chiefs}/i, @signatures);
}
my ($types_ref, $signers_ref) = extract_formatted_signatures(@signatures);
return ($commits, @$signers_ref);
@ -1296,10 +1261,6 @@ sub vcs_find_author {
@lines = &{$VCS_cmds{"execute_cmd"}}($cmd);
if (!$email_git_penguin_chiefs) {
@lines = grep(!/${penguin_chiefs}/i, @lines);
}
return @lines if !@lines;
my @authors = ();
@ -1925,10 +1886,6 @@ sub vcs_file_blame {
@lines = &{$VCS_cmds{"execute_cmd"}}($cmd);
if (!$email_git_penguin_chiefs) {
@lines = grep(!/${penguin_chiefs}/i, @lines);
}
last if !@lines;
my @authors = ();

View File

@ -648,7 +648,7 @@ static void do_ext_interrupt(CPUS390XState *env)
cpu_abort(CPU(cpu), "Ext int w/o ext mask\n");
}
if (env->ext_index < 0 || env->ext_index > MAX_EXT_QUEUE) {
if (env->ext_index < 0 || env->ext_index >= MAX_EXT_QUEUE) {
cpu_abort(CPU(cpu), "Ext queue overrun: %d\n", env->ext_index);
}
@ -696,7 +696,7 @@ static void do_io_interrupt(CPUS390XState *env)
if (env->io_index[isc] < 0) {
continue;
}
if (env->io_index[isc] > MAX_IO_QUEUE) {
if (env->io_index[isc] >= MAX_IO_QUEUE) {
cpu_abort(CPU(cpu), "I/O queue overrun for isc %d: %d\n",
isc, env->io_index[isc]);
}
@ -754,7 +754,7 @@ static void do_mchk_interrupt(CPUS390XState *env)
cpu_abort(CPU(cpu), "Machine check w/o mchk mask\n");
}
if (env->mchk_index < 0 || env->mchk_index > MAX_MCHK_QUEUE) {
if (env->mchk_index < 0 || env->mchk_index >= MAX_MCHK_QUEUE) {
cpu_abort(CPU(cpu), "Mchk queue overrun: %d\n", env->mchk_index);
}

View File

@ -373,7 +373,7 @@ void hbitmap_free(HBitmap *hb)
HBitmap *hbitmap_alloc(uint64_t size, int granularity)
{
HBitmap *hb = g_malloc0(sizeof (struct HBitmap));
HBitmap *hb = g_new0(struct HBitmap, 1);
unsigned i;
assert(granularity >= 0 && granularity < 64);
@ -384,7 +384,7 @@ HBitmap *hbitmap_alloc(uint64_t size, int granularity)
hb->granularity = granularity;
for (i = HBITMAP_LEVELS; i-- > 0; ) {
size = MAX((size + BITS_PER_LONG - 1) >> BITS_PER_LEVEL, 1);
hb->levels[i] = g_malloc0(size * sizeof(unsigned long));
hb->levels[i] = g_new0(unsigned long, size);
}
/* We necessarily have free bits in level 0 due to the definition

View File

@ -253,7 +253,7 @@ unsigned iov_copy(struct iovec *dst_iov, unsigned int dst_iov_cnt,
void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint)
{
qiov->iov = g_malloc(alloc_hint * sizeof(struct iovec));
qiov->iov = g_new(struct iovec, alloc_hint);
qiov->niov = 0;
qiov->nalloc = alloc_hint;
qiov->size = 0;
@ -277,7 +277,7 @@ void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len)
if (qiov->niov == qiov->nalloc) {
qiov->nalloc = 2 * qiov->nalloc + 1;
qiov->iov = g_realloc(qiov->iov, qiov->nalloc * sizeof(struct iovec));
qiov->iov = g_renew(struct iovec, qiov->iov, qiov->nalloc);
}
qiov->iov[qiov->niov].iov_base = base;
qiov->iov[qiov->niov].iov_len = len;

View File

@ -225,7 +225,7 @@ rfc3986_parse_scheme(URI *uri, const char **str) {
while (ISA_ALPHA(cur) || ISA_DIGIT(cur) ||
(*cur == '+') || (*cur == '-') || (*cur == '.')) cur++;
if (uri != NULL) {
if (uri->scheme != NULL) g_free(uri->scheme);
g_free(uri->scheme);
uri->scheme = g_strndup(*str, cur - *str);
}
*str = cur;
@ -262,8 +262,7 @@ rfc3986_parse_fragment(URI *uri, const char **str)
((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))
NEXT(cur);
if (uri != NULL) {
if (uri->fragment != NULL)
g_free(uri->fragment);
g_free(uri->fragment);
if (uri->cleanup & 2)
uri->fragment = g_strndup(*str, cur - *str);
else
@ -298,8 +297,7 @@ rfc3986_parse_query(URI *uri, const char **str)
((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))
NEXT(cur);
if (uri != NULL) {
if (uri->query != NULL)
g_free (uri->query);
g_free(uri->query);
uri->query = g_strndup (*str, cur - *str);
}
*str = cur;
@ -360,7 +358,7 @@ rfc3986_parse_user_info(URI *uri, const char **str)
NEXT(cur);
if (*cur == '@') {
if (uri != NULL) {
if (uri->user != NULL) g_free(uri->user);
g_free(uri->user);
if (uri->cleanup & 2)
uri->user = g_strndup(*str, cur - *str);
else
@ -473,9 +471,9 @@ not_ipv4:
NEXT(cur);
found:
if (uri != NULL) {
if (uri->authority != NULL) g_free(uri->authority);
g_free(uri->authority);
uri->authority = NULL;
if (uri->server != NULL) g_free(uri->server);
g_free(uri->server);
if (cur != host) {
if (uri->cleanup & 2)
uri->server = g_strndup(host, cur - host);
@ -585,7 +583,7 @@ rfc3986_parse_path_ab_empty(URI *uri, const char **str)
if (ret != 0) return(ret);
}
if (uri != NULL) {
if (uri->path != NULL) g_free(uri->path);
g_free(uri->path);
if (*str != cur) {
if (uri->cleanup & 2)
uri->path = g_strndup(*str, cur - *str);
@ -631,7 +629,7 @@ rfc3986_parse_path_absolute(URI *uri, const char **str)
}
}
if (uri != NULL) {
if (uri->path != NULL) g_free(uri->path);
g_free(uri->path);
if (cur != *str) {
if (uri->cleanup & 2)
uri->path = g_strndup(*str, cur - *str);
@ -673,7 +671,7 @@ rfc3986_parse_path_rootless(URI *uri, const char **str)
if (ret != 0) return(ret);
}
if (uri != NULL) {
if (uri->path != NULL) g_free(uri->path);
g_free(uri->path);
if (cur != *str) {
if (uri->cleanup & 2)
uri->path = g_strndup(*str, cur - *str);
@ -715,7 +713,7 @@ rfc3986_parse_path_no_scheme(URI *uri, const char **str)
if (ret != 0) return(ret);
}
if (uri != NULL) {
if (uri->path != NULL) g_free(uri->path);
g_free(uri->path);
if (cur != *str) {
if (uri->cleanup & 2)
uri->path = g_strndup(*str, cur - *str);
@ -769,7 +767,7 @@ rfc3986_parse_hier_part(URI *uri, const char **str)
} else {
/* path-empty is effectively empty */
if (uri != NULL) {
if (uri->path != NULL) g_free(uri->path);
g_free(uri->path);
uri->path = NULL;
}
}
@ -812,7 +810,7 @@ rfc3986_parse_relative_ref(URI *uri, const char *str) {
} else {
/* path-empty is effectively empty */
if (uri != NULL) {
if (uri->path != NULL) g_free(uri->path);
g_free(uri->path);
uri->path = NULL;
}
}
@ -1006,8 +1004,7 @@ URI *
uri_new(void) {
URI *ret;
ret = (URI *) g_malloc(sizeof(URI));
memset(ret, 0, sizeof(URI));
ret = g_new0(URI, 1);
return(ret);
}
@ -1285,21 +1282,21 @@ static void
uri_clean(URI *uri) {
if (uri == NULL) return;
if (uri->scheme != NULL) g_free(uri->scheme);
g_free(uri->scheme);
uri->scheme = NULL;
if (uri->server != NULL) g_free(uri->server);
g_free(uri->server);
uri->server = NULL;
if (uri->user != NULL) g_free(uri->user);
g_free(uri->user);
uri->user = NULL;
if (uri->path != NULL) g_free(uri->path);
g_free(uri->path);
uri->path = NULL;
if (uri->fragment != NULL) g_free(uri->fragment);
g_free(uri->fragment);
uri->fragment = NULL;
if (uri->opaque != NULL) g_free(uri->opaque);
g_free(uri->opaque);
uri->opaque = NULL;
if (uri->authority != NULL) g_free(uri->authority);
g_free(uri->authority);
uri->authority = NULL;
if (uri->query != NULL) g_free(uri->query);
g_free(uri->query);
uri->query = NULL;
}
@ -1711,10 +1708,8 @@ uri_resolve(const char *uri, const char *base) {
/*
* the base fragment must be ignored
*/
if (bas->fragment != NULL) {
g_free(bas->fragment);
bas->fragment = NULL;
}
g_free(bas->fragment);
bas->fragment = NULL;
val = uri_to_string(bas);
goto done;
}
@ -1736,24 +1731,21 @@ uri_resolve(const char *uri, const char *base) {
goto done;
if ((ref->scheme == NULL) && (ref->path == NULL) &&
((ref->authority == NULL) && (ref->server == NULL))) {
if (bas->scheme != NULL)
res->scheme = g_strdup(bas->scheme);
res->scheme = g_strdup(bas->scheme);
if (bas->authority != NULL)
res->authority = g_strdup(bas->authority);
else if (bas->server != NULL) {
res->server = g_strdup(bas->server);
if (bas->user != NULL)
res->user = g_strdup(bas->user);
res->port = bas->port;
res->server = g_strdup(bas->server);
res->user = g_strdup(bas->user);
res->port = bas->port;
}
if (bas->path != NULL)
res->path = g_strdup(bas->path);
if (ref->query != NULL)
res->path = g_strdup(bas->path);
if (ref->query != NULL) {
res->query = g_strdup (ref->query);
else if (bas->query != NULL)
res->query = g_strdup(bas->query);
if (ref->fragment != NULL)
res->fragment = g_strdup(ref->fragment);
} else {
res->query = g_strdup(bas->query);
}
res->fragment = g_strdup(ref->fragment);
goto step_7;
}
@ -1767,13 +1759,10 @@ uri_resolve(const char *uri, const char *base) {
val = uri_to_string(ref);
goto done;
}
if (bas->scheme != NULL)
res->scheme = g_strdup(bas->scheme);
res->scheme = g_strdup(bas->scheme);
if (ref->query != NULL)
res->query = g_strdup(ref->query);
if (ref->fragment != NULL)
res->fragment = g_strdup(ref->fragment);
res->query = g_strdup(ref->query);
res->fragment = g_strdup(ref->fragment);
/*
* 4) If the authority component is defined, then the reference is a
@ -1787,20 +1776,17 @@ uri_resolve(const char *uri, const char *base) {
res->authority = g_strdup(ref->authority);
else {
res->server = g_strdup(ref->server);
if (ref->user != NULL)
res->user = g_strdup(ref->user);
res->user = g_strdup(ref->user);
res->port = ref->port;
}
if (ref->path != NULL)
res->path = g_strdup(ref->path);
res->path = g_strdup(ref->path);
goto step_7;
}
if (bas->authority != NULL)
res->authority = g_strdup(bas->authority);
else if (bas->server != NULL) {
res->server = g_strdup(bas->server);
if (bas->user != NULL)
res->user = g_strdup(bas->user);
res->server = g_strdup(bas->server);
res->user = g_strdup(bas->user);
res->port = bas->port;
}