Commit 511d2b140f3ff2f80d14637cdc2f29743a2daa51
1 parent
c2764719
Sparse fixes: NULL use, header order, ANSI prototypes, static
Fix Sparse warnings: * use NULL instead of plain 0 * rearrange header include order to avoid redefining types accidentally * ANSIfy SLIRP * avoid "restrict" keyword * add static git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6736 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
35 changed files
with
214 additions
and
286 deletions
block-dmg.c
| ... | ... | @@ -85,7 +85,7 @@ static int dmg_open(BlockDriverState *bs, const char *filename, int flags) |
| 85 | 85 | return -errno; |
| 86 | 86 | bs->read_only = 1; |
| 87 | 87 | s->n_chunks = 0; |
| 88 | - s->offsets = s->lengths = s->sectors = s->sectorcounts = 0; | |
| 88 | + s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL; | |
| 89 | 89 | |
| 90 | 90 | /* read offset of info blocks */ |
| 91 | 91 | if(lseek(s->fd,-0x1d8,SEEK_END)<0) { | ... | ... |
block-vmdk.c
| ... | ... | @@ -134,7 +134,7 @@ static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent) |
| 134 | 134 | cid_str_size = sizeof("CID"); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if ((p_name = strstr(desc,cid_str)) != 0) { | |
| 137 | + if ((p_name = strstr(desc,cid_str)) != NULL) { | |
| 138 | 138 | p_name += cid_str_size; |
| 139 | 139 | sscanf(p_name,"%x",&cid); |
| 140 | 140 | } |
| ... | ... | @@ -154,7 +154,7 @@ static int vmdk_write_cid(BlockDriverState *bs, uint32_t cid) |
| 154 | 154 | |
| 155 | 155 | tmp_str = strstr(desc,"parentCID"); |
| 156 | 156 | pstrcpy(tmp_desc, sizeof(tmp_desc), tmp_str); |
| 157 | - if ((p_name = strstr(desc,"CID")) != 0) { | |
| 157 | + if ((p_name = strstr(desc,"CID")) != NULL) { | |
| 158 | 158 | p_name += sizeof("CID"); |
| 159 | 159 | snprintf(p_name, sizeof(desc) - (p_name - desc), "%x\n", cid); |
| 160 | 160 | pstrcat(desc, sizeof(desc), tmp_desc); |
| ... | ... | @@ -239,7 +239,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file) |
| 239 | 239 | if (read(p_fd, p_desc, DESC_SIZE) != DESC_SIZE) |
| 240 | 240 | goto fail; |
| 241 | 241 | |
| 242 | - if ((p_name = strstr(p_desc,"CID")) != 0) { | |
| 242 | + if ((p_name = strstr(p_desc,"CID")) != NULL) { | |
| 243 | 243 | p_name += sizeof("CID"); |
| 244 | 244 | sscanf(p_name,"%x",&p_cid); |
| 245 | 245 | } |
| ... | ... | @@ -330,12 +330,12 @@ static int vmdk_parent_open(BlockDriverState *bs, const char * filename) |
| 330 | 330 | if (bdrv_pread(s->hd, 0x200, desc, DESC_SIZE) != DESC_SIZE) |
| 331 | 331 | return -1; |
| 332 | 332 | |
| 333 | - if ((p_name = strstr(desc,"parentFileNameHint")) != 0) { | |
| 333 | + if ((p_name = strstr(desc,"parentFileNameHint")) != NULL) { | |
| 334 | 334 | char *end_name; |
| 335 | 335 | struct stat file_buf; |
| 336 | 336 | |
| 337 | 337 | p_name += sizeof("parentFileNameHint") + 1; |
| 338 | - if ((end_name = strchr(p_name,'\"')) == 0) | |
| 338 | + if ((end_name = strchr(p_name,'\"')) == NULL) | |
| 339 | 339 | return -1; |
| 340 | 340 | if ((end_name - p_name) > sizeof (s->hd->backing_file) - 1) |
| 341 | 341 | return -1; | ... | ... |
block-vvfat.c
| ... | ... | @@ -78,7 +78,7 @@ typedef struct array_t { |
| 78 | 78 | |
| 79 | 79 | static inline void array_init(array_t* array,unsigned int item_size) |
| 80 | 80 | { |
| 81 | - array->pointer=0; | |
| 81 | + array->pointer = NULL; | |
| 82 | 82 | array->size=0; |
| 83 | 83 | array->next=0; |
| 84 | 84 | array->item_size=item_size; |
| ... | ... | @@ -129,7 +129,7 @@ static inline void* array_insert(array_t* array,unsigned int index,unsigned int |
| 129 | 129 | int increment=count*array->item_size; |
| 130 | 130 | array->pointer=qemu_realloc(array->pointer,array->size+increment); |
| 131 | 131 | if(!array->pointer) |
| 132 | - return 0; | |
| 132 | + return NULL; | |
| 133 | 133 | array->size+=increment; |
| 134 | 134 | } |
| 135 | 135 | memmove(array->pointer+(index+count)*array->item_size, |
| ... | ... | @@ -604,8 +604,8 @@ static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s, |
| 604 | 604 | unsigned int directory_start, const char* filename, int is_dot) |
| 605 | 605 | { |
| 606 | 606 | int i,j,long_index=s->directory.next; |
| 607 | - direntry_t* entry=0; | |
| 608 | - direntry_t* entry_long=0; | |
| 607 | + direntry_t* entry = NULL; | |
| 608 | + direntry_t* entry_long = NULL; | |
| 609 | 609 | |
| 610 | 610 | if(is_dot) { |
| 611 | 611 | entry=array_get_next(&(s->directory)); |
| ... | ... | @@ -696,7 +696,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index) |
| 696 | 696 | int first_cluster = mapping->begin; |
| 697 | 697 | int parent_index = mapping->info.dir.parent_mapping_index; |
| 698 | 698 | mapping_t* parent_mapping = (mapping_t*) |
| 699 | - (parent_index >= 0 ? array_get(&(s->mapping), parent_index) : 0); | |
| 699 | + (parent_index >= 0 ? array_get(&(s->mapping), parent_index) : NULL); | |
| 700 | 700 | int first_cluster_of_parent = parent_mapping ? parent_mapping->begin : -1; |
| 701 | 701 | |
| 702 | 702 | DIR* dir=opendir(dirname); |
| ... | ... | @@ -1125,10 +1125,10 @@ static inline mapping_t* find_mapping_for_cluster(BDRVVVFATState* s,int cluster_ |
| 1125 | 1125 | int index=find_mapping_for_cluster_aux(s,cluster_num,0,s->mapping.next); |
| 1126 | 1126 | mapping_t* mapping; |
| 1127 | 1127 | if(index>=s->mapping.next) |
| 1128 | - return 0; | |
| 1128 | + return NULL; | |
| 1129 | 1129 | mapping=array_get(&(s->mapping),index); |
| 1130 | 1130 | if(mapping->begin>cluster_num) |
| 1131 | - return 0; | |
| 1131 | + return NULL; | |
| 1132 | 1132 | assert(mapping->begin<=cluster_num && mapping->end>cluster_num); |
| 1133 | 1133 | return mapping; |
| 1134 | 1134 | } | ... | ... |
bt-host.c
| ... | ... | @@ -171,7 +171,7 @@ struct HCIInfo *bt_host_hci(const char *id) |
| 171 | 171 | if (fd < 0) { |
| 172 | 172 | fprintf(stderr, "qemu: Can't open `%s': %s (%i)\n", |
| 173 | 173 | id, strerror(errno), errno); |
| 174 | - return 0; | |
| 174 | + return NULL; | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | # ifdef CONFIG_BLUEZ |
| ... | ... | @@ -192,7 +192,7 @@ struct HCIInfo *bt_host_hci(const char *id) |
| 192 | 192 | s->hci.acl_send = bt_host_acl; |
| 193 | 193 | s->hci.bdaddr_set = bt_host_bdaddr_set; |
| 194 | 194 | |
| 195 | - qemu_set_fd_handler2(s->fd, bt_host_read_poll, bt_host_read, 0, s); | |
| 195 | + qemu_set_fd_handler2(s->fd, bt_host_read_poll, bt_host_read, NULL, s); | |
| 196 | 196 | |
| 197 | 197 | return &s->hci; |
| 198 | 198 | } | ... | ... |
bt-vhci.c
| ... | ... | @@ -165,5 +165,5 @@ void bt_vhci_init(struct HCIInfo *info) |
| 165 | 165 | s->info->evt_recv = vhci_out_hci_packet_event; |
| 166 | 166 | s->info->acl_recv = vhci_out_hci_packet_acl; |
| 167 | 167 | |
| 168 | - qemu_set_fd_handler(s->fd, vhci_read, 0, s); | |
| 168 | + qemu_set_fd_handler(s->fd, vhci_read, NULL, s); | |
| 169 | 169 | } | ... | ... |
console.c
| ... | ... | @@ -1327,7 +1327,7 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds, const c |
| 1327 | 1327 | unsigned height; |
| 1328 | 1328 | static int color_inited; |
| 1329 | 1329 | |
| 1330 | - s = new_console(ds, (p == 0) ? TEXT_CONSOLE : TEXT_CONSOLE_FIXED_SIZE); | |
| 1330 | + s = new_console(ds, (p == NULL) ? TEXT_CONSOLE : TEXT_CONSOLE_FIXED_SIZE); | |
| 1331 | 1331 | if (!s) { |
| 1332 | 1332 | free(chr); |
| 1333 | 1333 | return; |
| ... | ... | @@ -1353,7 +1353,7 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds, const c |
| 1353 | 1353 | s->y = 0; |
| 1354 | 1354 | width = ds_get_width(s->ds); |
| 1355 | 1355 | height = ds_get_height(s->ds); |
| 1356 | - if (p != 0) { | |
| 1356 | + if (p != NULL) { | |
| 1357 | 1357 | width = strtoul(p, (char **)&p, 10); |
| 1358 | 1358 | if (*p == 'C') { |
| 1359 | 1359 | p++; | ... | ... |
curses.c
| ... | ... | @@ -21,11 +21,6 @@ |
| 21 | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | 22 | * THE SOFTWARE. |
| 23 | 23 | */ |
| 24 | - | |
| 25 | -#include "qemu-common.h" | |
| 26 | -#include "console.h" | |
| 27 | -#include "sysemu.h" | |
| 28 | - | |
| 29 | 24 | #include <curses.h> |
| 30 | 25 | |
| 31 | 26 | #ifndef _WIN32 |
| ... | ... | @@ -38,6 +33,10 @@ |
| 38 | 33 | #define resize_term resizeterm |
| 39 | 34 | #endif |
| 40 | 35 | |
| 36 | +#include "qemu-common.h" | |
| 37 | +#include "console.h" | |
| 38 | +#include "sysemu.h" | |
| 39 | + | |
| 41 | 40 | #define FONT_HEIGHT 16 |
| 42 | 41 | #define FONT_WIDTH 8 |
| 43 | 42 | ... | ... |
exec.c
| ... | ... | @@ -179,7 +179,7 @@ static void io_mem_init(void); |
| 179 | 179 | CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4]; |
| 180 | 180 | CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4]; |
| 181 | 181 | void *io_mem_opaque[IO_MEM_NB_ENTRIES]; |
| 182 | -char io_mem_used[IO_MEM_NB_ENTRIES]; | |
| 182 | +static char io_mem_used[IO_MEM_NB_ENTRIES]; | |
| 183 | 183 | static int io_mem_watch; |
| 184 | 184 | #endif |
| 185 | 185 | ... | ... |
hw/bt-hci.c
| ... | ... | @@ -446,7 +446,7 @@ static inline uint8_t *bt_hci_event_start(struct bt_hci_s *hci, |
| 446 | 446 | mask_byte = (evt - 1) >> 3; |
| 447 | 447 | mask = 1 << ((evt - 1) & 3); |
| 448 | 448 | if (mask & bt_event_reserved_mask[mask_byte] & ~hci->event_mask[mask_byte]) |
| 449 | - return 0; | |
| 449 | + return NULL; | |
| 450 | 450 | |
| 451 | 451 | packet = hci->evt_packet(hci->opaque); |
| 452 | 452 | packet[0] = evt; |
| ... | ... | @@ -664,7 +664,7 @@ static void bt_hci_lmp_link_establish(struct bt_hci_s *hci, |
| 664 | 664 | static void bt_hci_lmp_link_teardown(struct bt_hci_s *hci, uint16_t handle) |
| 665 | 665 | { |
| 666 | 666 | handle &= ~HCI_HANDLE_OFFSET; |
| 667 | - hci->lm.handle[handle].link = 0; | |
| 667 | + hci->lm.handle[handle].link = NULL; | |
| 668 | 668 | |
| 669 | 669 | if (bt_hci_role_master(hci, handle)) { |
| 670 | 670 | qemu_del_timer(hci->lm.handle[handle].acl_mode_timer); |
| ... | ... | @@ -1138,7 +1138,7 @@ static void bt_hci_reset(struct bt_hci_s *hci) |
| 1138 | 1138 | hci->device.page_scan = 0; |
| 1139 | 1139 | if (hci->device.lmp_name) |
| 1140 | 1140 | qemu_free((void *) hci->device.lmp_name); |
| 1141 | - hci->device.lmp_name = 0; | |
| 1141 | + hci->device.lmp_name = NULL; | |
| 1142 | 1142 | hci->device.class[0] = 0x00; |
| 1143 | 1143 | hci->device.class[1] = 0x00; |
| 1144 | 1144 | hci->device.class[2] = 0x00; |
| ... | ... | @@ -1617,7 +1617,7 @@ static void bt_submit_hci(struct HCIInfo *info, |
| 1617 | 1617 | |
| 1618 | 1618 | bt_hci_event_status(hci, HCI_SUCCESS); |
| 1619 | 1619 | bt_hci_connection_accept(hci, hci->conn_req_host); |
| 1620 | - hci->conn_req_host = 0; | |
| 1620 | + hci->conn_req_host = NULL; | |
| 1621 | 1621 | break; |
| 1622 | 1622 | |
| 1623 | 1623 | case cmd_opcode_pack(OGF_LINK_CTL, OCF_REJECT_CONN_REQ): |
| ... | ... | @@ -1634,7 +1634,7 @@ static void bt_submit_hci(struct HCIInfo *info, |
| 1634 | 1634 | bt_hci_connection_reject(hci, hci->conn_req_host, |
| 1635 | 1635 | PARAM(reject_conn_req, reason)); |
| 1636 | 1636 | bt_hci_connection_reject_event(hci, &hci->conn_req_host->bd_addr); |
| 1637 | - hci->conn_req_host = 0; | |
| 1637 | + hci->conn_req_host = NULL; | |
| 1638 | 1638 | break; |
| 1639 | 1639 | |
| 1640 | 1640 | case cmd_opcode_pack(OGF_LINK_CTL, OCF_AUTH_REQUESTED): | ... | ... |
hw/bt-hid.c
| ... | ... | @@ -324,7 +324,8 @@ static void bt_hid_control_transaction(struct bt_hid_device_s *s, |
| 324 | 324 | break; |
| 325 | 325 | } |
| 326 | 326 | s->proto = parameter; |
| 327 | - s->usbdev->handle_control(s->usbdev, SET_PROTOCOL, s->proto, 0, 0, 0); | |
| 327 | + s->usbdev->handle_control(s->usbdev, SET_PROTOCOL, s->proto, 0, 0, | |
| 328 | + NULL); | |
| 328 | 329 | ret = BT_HS_SUCCESSFUL; |
| 329 | 330 | break; |
| 330 | 331 | |
| ... | ... | @@ -347,7 +348,7 @@ static void bt_hid_control_transaction(struct bt_hid_device_s *s, |
| 347 | 348 | /* We don't need to know about the Idle Rate here really, |
| 348 | 349 | * so just pass it on to the device. */ |
| 349 | 350 | ret = s->usbdev->handle_control(s->usbdev, |
| 350 | - SET_IDLE, data[1], 0, 0, 0) ? | |
| 351 | + SET_IDLE, data[1], 0, 0, NULL) ? | |
| 351 | 352 | BT_HS_SUCCESSFUL : BT_HS_ERR_INVALID_PARAMETER; |
| 352 | 353 | /* XXX: Does this generate a handshake? */ |
| 353 | 354 | break; |
| ... | ... | @@ -462,7 +463,7 @@ static void bt_hid_close_control(void *opaque) |
| 462 | 463 | { |
| 463 | 464 | struct bt_hid_device_s *hid = opaque; |
| 464 | 465 | |
| 465 | - hid->control = 0; | |
| 466 | + hid->control = NULL; | |
| 466 | 467 | bt_hid_connected_update(hid); |
| 467 | 468 | } |
| 468 | 469 | |
| ... | ... | @@ -470,7 +471,7 @@ static void bt_hid_close_interrupt(void *opaque) |
| 470 | 471 | { |
| 471 | 472 | struct bt_hid_device_s *hid = opaque; |
| 472 | 473 | |
| 473 | - hid->interrupt = 0; | |
| 474 | + hid->interrupt = NULL; | |
| 474 | 475 | bt_hid_connected_update(hid); |
| 475 | 476 | } |
| 476 | 477 | ... | ... |
hw/bt-l2cap.c
| ... | ... | @@ -401,7 +401,7 @@ static inline struct bt_l2cap_psm_s *l2cap_psm( |
| 401 | 401 | static struct l2cap_chan_s *l2cap_channel_open(struct l2cap_instance_s *l2cap, |
| 402 | 402 | int psm, int source_cid) |
| 403 | 403 | { |
| 404 | - struct l2cap_chan_s *ch = 0; | |
| 404 | + struct l2cap_chan_s *ch = NULL; | |
| 405 | 405 | struct bt_l2cap_psm_s *psm_info; |
| 406 | 406 | int result, status; |
| 407 | 407 | int cid = l2cap_cid_new(l2cap); |
| ... | ... | @@ -452,7 +452,7 @@ static struct l2cap_chan_s *l2cap_channel_open(struct l2cap_instance_s *l2cap, |
| 452 | 452 | static void l2cap_channel_close(struct l2cap_instance_s *l2cap, |
| 453 | 453 | int cid, int source_cid) |
| 454 | 454 | { |
| 455 | - struct l2cap_chan_s *ch = 0; | |
| 455 | + struct l2cap_chan_s *ch = NULL; | |
| 456 | 456 | |
| 457 | 457 | /* According to Volume 3, section 6.1.1, pg 1048 of BT Core V2.0, a |
| 458 | 458 | * connection in CLOSED state still responds with a L2CAP_DisconnectRsp |
| ... | ... | @@ -472,7 +472,7 @@ static void l2cap_channel_close(struct l2cap_instance_s *l2cap, |
| 472 | 472 | return; |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - l2cap->cid[cid] = 0; | |
| 475 | + l2cap->cid[cid] = NULL; | |
| 476 | 476 | |
| 477 | 477 | ch->params.close(ch->params.opaque); |
| 478 | 478 | qemu_free(ch); |
| ... | ... | @@ -484,7 +484,7 @@ static void l2cap_channel_close(struct l2cap_instance_s *l2cap, |
| 484 | 484 | static void l2cap_channel_config_null(struct l2cap_instance_s *l2cap, |
| 485 | 485 | struct l2cap_chan_s *ch) |
| 486 | 486 | { |
| 487 | - l2cap_configuration_request(l2cap, ch->remote_cid, 0, 0, 0); | |
| 487 | + l2cap_configuration_request(l2cap, ch->remote_cid, 0, NULL, 0); | |
| 488 | 488 | ch->config_req_id = l2cap->last_id; |
| 489 | 489 | ch->config &= ~L2CAP_CFG_INIT; |
| 490 | 490 | } | ... | ... |
hw/bt-sdp.c
hw/ppce500_mpc8544ds.c
| ... | ... | @@ -47,6 +47,7 @@ |
| 47 | 47 | #define MPC8544_PCI_IO 0xE1000000 |
| 48 | 48 | #define MPC8544_PCI_IOLEN 0x10000 |
| 49 | 49 | |
| 50 | +#ifdef HAVE_FDT | |
| 50 | 51 | static int mpc8544_copy_soc_cell(void *fdt, const char *node, const char *prop) |
| 51 | 52 | { |
| 52 | 53 | uint32_t cell; |
| ... | ... | @@ -68,6 +69,7 @@ static int mpc8544_copy_soc_cell(void *fdt, const char *node, const char *prop) |
| 68 | 69 | out: |
| 69 | 70 | return ret; |
| 70 | 71 | } |
| 72 | +#endif | |
| 71 | 73 | |
| 72 | 74 | static void *mpc8544_load_device_tree(void *addr, |
| 73 | 75 | uint32_t ramsize, | ... | ... |
hw/usb-bt.c
| ... | ... | @@ -612,9 +612,9 @@ static void usb_bt_handle_destroy(USBDevice *dev) |
| 612 | 612 | { |
| 613 | 613 | struct USBBtState *s = (struct USBBtState *) dev->opaque; |
| 614 | 614 | |
| 615 | - s->hci->opaque = 0; | |
| 616 | - s->hci->evt_recv = 0; | |
| 617 | - s->hci->acl_recv = 0; | |
| 615 | + s->hci->opaque = NULL; | |
| 616 | + s->hci->evt_recv = NULL; | |
| 617 | + s->hci->acl_recv = NULL; | |
| 618 | 618 | qemu_free(s); |
| 619 | 619 | } |
| 620 | 620 | ... | ... |
hw/vmware_vga.c
| ... | ... | @@ -230,7 +230,6 @@ enum { |
| 230 | 230 | #ifdef VERBOSE |
| 231 | 231 | # define GUEST_OS_BASE 0x5001 |
| 232 | 232 | static const char *vmsvga_guest_id[] = { |
| 233 | - [0x00 ... 0x15] = "an unknown OS", | |
| 234 | 233 | [0x00] = "Dos", |
| 235 | 234 | [0x01] = "Windows 3.1", |
| 236 | 235 | [0x02] = "Windows 95", |
| ... | ... | @@ -240,8 +239,18 @@ static const char *vmsvga_guest_id[] = { |
| 240 | 239 | [0x06] = "Windows 2000", |
| 241 | 240 | [0x07] = "Linux", |
| 242 | 241 | [0x08] = "OS/2", |
| 242 | + [0x09] = "an unknown OS", | |
| 243 | 243 | [0x0a] = "BSD", |
| 244 | 244 | [0x0b] = "Whistler", |
| 245 | + [0x0c] = "an unknown OS", | |
| 246 | + [0x0d] = "an unknown OS", | |
| 247 | + [0x0e] = "an unknown OS", | |
| 248 | + [0x0f] = "an unknown OS", | |
| 249 | + [0x10] = "an unknown OS", | |
| 250 | + [0x11] = "an unknown OS", | |
| 251 | + [0x12] = "an unknown OS", | |
| 252 | + [0x13] = "an unknown OS", | |
| 253 | + [0x14] = "an unknown OS", | |
| 245 | 254 | [0x15] = "Windows 2003", |
| 246 | 255 | }; |
| 247 | 256 | #endif | ... | ... |
hw/wm8750.c
| ... | ... | @@ -184,12 +184,12 @@ static void wm8750_set_format(struct wm8750_s *s) |
| 184 | 184 | for (i = 0; i < IN_PORT_N; i ++) |
| 185 | 185 | if (s->adc_voice[i]) { |
| 186 | 186 | AUD_close_in(&s->card, s->adc_voice[i]); |
| 187 | - s->adc_voice[i] = 0; | |
| 187 | + s->adc_voice[i] = NULL; | |
| 188 | 188 | } |
| 189 | 189 | for (i = 0; i < OUT_PORT_N; i ++) |
| 190 | 190 | if (s->dac_voice[i]) { |
| 191 | 191 | AUD_close_out(&s->card, s->dac_voice[i]); |
| 192 | - s->dac_voice[i] = 0; | |
| 192 | + s->dac_voice[i] = NULL; | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if (!s->enable) | ... | ... |
monitor.c
| ... | ... | @@ -21,6 +21,7 @@ |
| 21 | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | 22 | * THE SOFTWARE. |
| 23 | 23 | */ |
| 24 | +#include <dirent.h> | |
| 24 | 25 | #include "hw/hw.h" |
| 25 | 26 | #include "hw/usb.h" |
| 26 | 27 | #include "hw/pcmcia.h" |
| ... | ... | @@ -37,7 +38,6 @@ |
| 37 | 38 | #include "audio/audio.h" |
| 38 | 39 | #include "disas.h" |
| 39 | 40 | #include "balloon.h" |
| 40 | -#include <dirent.h> | |
| 41 | 41 | #include "qemu-timer.h" |
| 42 | 42 | #include "migration.h" |
| 43 | 43 | #include "kvm.h" | ... | ... |
net.c
| ... | ... | @@ -21,14 +21,6 @@ |
| 21 | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | 22 | * THE SOFTWARE. |
| 23 | 23 | */ |
| 24 | -#include "qemu-common.h" | |
| 25 | -#include "net.h" | |
| 26 | -#include "monitor.h" | |
| 27 | -#include "sysemu.h" | |
| 28 | -#include "qemu-timer.h" | |
| 29 | -#include "qemu-char.h" | |
| 30 | -#include "audio/audio.h" | |
| 31 | - | |
| 32 | 24 | #include <unistd.h> |
| 33 | 25 | #include <fcntl.h> |
| 34 | 26 | #include <signal.h> |
| ... | ... | @@ -98,12 +90,6 @@ |
| 98 | 90 | #endif |
| 99 | 91 | #endif |
| 100 | 92 | |
| 101 | -#include "qemu_socket.h" | |
| 102 | - | |
| 103 | -#if defined(CONFIG_SLIRP) | |
| 104 | -#include "libslirp.h" | |
| 105 | -#endif | |
| 106 | - | |
| 107 | 93 | #if defined(__OpenBSD__) |
| 108 | 94 | #include <util.h> |
| 109 | 95 | #endif |
| ... | ... | @@ -120,6 +106,20 @@ |
| 120 | 106 | #define memalign(align, size) malloc(size) |
| 121 | 107 | #endif |
| 122 | 108 | |
| 109 | +#include "qemu-common.h" | |
| 110 | +#include "net.h" | |
| 111 | +#include "monitor.h" | |
| 112 | +#include "sysemu.h" | |
| 113 | +#include "qemu-timer.h" | |
| 114 | +#include "qemu-char.h" | |
| 115 | +#include "audio/audio.h" | |
| 116 | +#include "qemu_socket.h" | |
| 117 | + | |
| 118 | +#if defined(CONFIG_SLIRP) | |
| 119 | +#include "libslirp.h" | |
| 120 | +#endif | |
| 121 | + | |
| 122 | + | |
| 123 | 123 | static VLANState *first_vlan; |
| 124 | 124 | |
| 125 | 125 | /***********************************************************/ |
| ... | ... | @@ -585,7 +585,7 @@ static void erase_dir(char *dir_name) |
| 585 | 585 | char filename[1024]; |
| 586 | 586 | |
| 587 | 587 | /* erase all the files in the directory */ |
| 588 | - if ((d = opendir(dir_name)) != 0) { | |
| 588 | + if ((d = opendir(dir_name)) != NULL) { | |
| 589 | 589 | for(;;) { |
| 590 | 590 | de = readdir(d); |
| 591 | 591 | if (!de) |
| ... | ... | @@ -673,7 +673,7 @@ void do_info_slirp(Monitor *mon) |
| 673 | 673 | struct VMChannel { |
| 674 | 674 | CharDriverState *hd; |
| 675 | 675 | int port; |
| 676 | -} *vmchannels; | |
| 676 | +}; | |
| 677 | 677 | |
| 678 | 678 | static int vmchannel_can_read(void *opaque) |
| 679 | 679 | { | ... | ... |
osdep.c
| ... | ... | @@ -33,9 +33,6 @@ |
| 33 | 33 | #include <sys/statvfs.h> |
| 34 | 34 | #endif |
| 35 | 35 | |
| 36 | -#include "qemu-common.h" | |
| 37 | -#include "sysemu.h" | |
| 38 | - | |
| 39 | 36 | #ifdef _WIN32 |
| 40 | 37 | #define WIN32_LEAN_AND_MEAN |
| 41 | 38 | #include <windows.h> |
| ... | ... | @@ -45,6 +42,8 @@ |
| 45 | 42 | #include <malloc.h> |
| 46 | 43 | #endif |
| 47 | 44 | |
| 45 | +#include "qemu-common.h" | |
| 46 | +#include "sysemu.h" | |
| 48 | 47 | #include "qemu_socket.h" |
| 49 | 48 | |
| 50 | 49 | #if defined(_WIN32) | ... | ... |
savevm.c
| ... | ... | @@ -21,18 +21,6 @@ |
| 21 | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | 22 | * THE SOFTWARE. |
| 23 | 23 | */ |
| 24 | -#include "qemu-common.h" | |
| 25 | -#include "hw/hw.h" | |
| 26 | -#include "net.h" | |
| 27 | -#include "monitor.h" | |
| 28 | -#include "sysemu.h" | |
| 29 | -#include "qemu-timer.h" | |
| 30 | -#include "qemu-char.h" | |
| 31 | -#include "block.h" | |
| 32 | -#include "audio/audio.h" | |
| 33 | -#include "migration.h" | |
| 34 | -#include "qemu_socket.h" | |
| 35 | - | |
| 36 | 24 | #include <unistd.h> |
| 37 | 25 | #include <fcntl.h> |
| 38 | 26 | #include <signal.h> |
| ... | ... | @@ -87,6 +75,18 @@ |
| 87 | 75 | #define memalign(align, size) malloc(size) |
| 88 | 76 | #endif |
| 89 | 77 | |
| 78 | +#include "qemu-common.h" | |
| 79 | +#include "hw/hw.h" | |
| 80 | +#include "net.h" | |
| 81 | +#include "monitor.h" | |
| 82 | +#include "sysemu.h" | |
| 83 | +#include "qemu-timer.h" | |
| 84 | +#include "qemu-char.h" | |
| 85 | +#include "block.h" | |
| 86 | +#include "audio/audio.h" | |
| 87 | +#include "migration.h" | |
| 88 | +#include "qemu_socket.h" | |
| 89 | + | |
| 90 | 90 | /* point to the block driver where the snapshots are managed */ |
| 91 | 91 | static BlockDriverState *bs_snapshots; |
| 92 | 92 | ... | ... |
sdl.c
| ... | ... | @@ -21,11 +21,6 @@ |
| 21 | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | 22 | * THE SOFTWARE. |
| 23 | 23 | */ |
| 24 | -#include "qemu-common.h" | |
| 25 | -#include "console.h" | |
| 26 | -#include "sysemu.h" | |
| 27 | -#include "x_keymap.h" | |
| 28 | - | |
| 29 | 24 | #include <SDL.h> |
| 30 | 25 | #include <SDL/SDL_syswm.h> |
| 31 | 26 | |
| ... | ... | @@ -33,6 +28,11 @@ |
| 33 | 28 | #include <signal.h> |
| 34 | 29 | #endif |
| 35 | 30 | |
| 31 | +#include "qemu-common.h" | |
| 32 | +#include "console.h" | |
| 33 | +#include "sysemu.h" | |
| 34 | +#include "x_keymap.h" | |
| 35 | + | |
| 36 | 36 | static DisplayChangeListener *dcl; |
| 37 | 37 | static SDL_Surface *real_screen; |
| 38 | 38 | static SDL_Surface *guest_screen = NULL; | ... | ... |
slirp/if.c
| ... | ... | @@ -32,7 +32,7 @@ ifs_remque(struct mbuf *ifm) |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | void |
| 35 | -if_init() | |
| 35 | +if_init(void) | |
| 36 | 36 | { |
| 37 | 37 | if_fastq.ifq_next = if_fastq.ifq_prev = &if_fastq; |
| 38 | 38 | if_batchq.ifq_next = if_batchq.ifq_prev = &if_batchq; |
| ... | ... | @@ -133,9 +133,7 @@ if_input(ttyp) |
| 133 | 133 | * it'll temporarily get downgraded to the batchq) |
| 134 | 134 | */ |
| 135 | 135 | void |
| 136 | -if_output(so, ifm) | |
| 137 | - struct socket *so; | |
| 138 | - struct mbuf *ifm; | |
| 136 | +if_output(struct socket *so, struct mbuf *ifm) | |
| 139 | 137 | { |
| 140 | 138 | struct mbuf *ifq; |
| 141 | 139 | int on_fastq = 1; | ... | ... |
slirp/ip_icmp.c
| ... | ... | @@ -68,9 +68,7 @@ static const int icmp_flush[19] = { |
| 68 | 68 | * Process a received ICMP message. |
| 69 | 69 | */ |
| 70 | 70 | void |
| 71 | -icmp_input(m, hlen) | |
| 72 | - struct mbuf *m; | |
| 73 | - int hlen; | |
| 71 | +icmp_input(struct mbuf *m, int hlen) | |
| 74 | 72 | { |
| 75 | 73 | register struct icmp *icp; |
| 76 | 74 | register struct ip *ip=mtod(m, struct ip *); |
| ... | ... | @@ -319,8 +317,7 @@ end_error: |
| 319 | 317 | * Reflect the ip packet back to the source |
| 320 | 318 | */ |
| 321 | 319 | void |
| 322 | -icmp_reflect(m) | |
| 323 | - struct mbuf *m; | |
| 320 | +icmp_reflect(struct mbuf *m) | |
| 324 | 321 | { |
| 325 | 322 | register struct ip *ip = mtod(m, struct ip *); |
| 326 | 323 | int hlen = ip->ip_hl << 2; | ... | ... |
slirp/ip_input.c
| ... | ... | @@ -60,7 +60,7 @@ static void ip_deq(register struct ipasfrag *p); |
| 60 | 60 | * All protocols not implemented in kernel go to raw IP protocol handler. |
| 61 | 61 | */ |
| 62 | 62 | void |
| 63 | -ip_init() | |
| 63 | +ip_init(void) | |
| 64 | 64 | { |
| 65 | 65 | ipq.ip_link.next = ipq.ip_link.prev = &ipq.ip_link; |
| 66 | 66 | ip_id = tt.tv_sec & 0xffff; |
| ... | ... | @@ -73,8 +73,7 @@ ip_init() |
| 73 | 73 | * try to reassemble. Process options. Pass to next level. |
| 74 | 74 | */ |
| 75 | 75 | void |
| 76 | -ip_input(m) | |
| 77 | - struct mbuf *m; | |
| 76 | +ip_input(struct mbuf *m) | |
| 78 | 77 | { |
| 79 | 78 | register struct ip *ip; |
| 80 | 79 | int hlen; |
| ... | ... | @@ -222,7 +221,7 @@ ip_input(m) |
| 222 | 221 | if (ip->ip_tos & 1 || ip->ip_off) { |
| 223 | 222 | STAT(ipstat.ips_fragments++); |
| 224 | 223 | ip = ip_reass(ip, fp); |
| 225 | - if (ip == 0) | |
| 224 | + if (ip == NULL) | |
| 226 | 225 | return; |
| 227 | 226 | STAT(ipstat.ips_reassembled++); |
| 228 | 227 | m = dtom(ip); |
| ... | ... | @@ -289,7 +288,7 @@ ip_reass(register struct ip *ip, register struct ipq *fp) |
| 289 | 288 | /* |
| 290 | 289 | * If first fragment to arrive, create a reassembly queue. |
| 291 | 290 | */ |
| 292 | - if (fp == 0) { | |
| 291 | + if (fp == NULL) { | |
| 293 | 292 | struct mbuf *t; |
| 294 | 293 | if ((t = m_get()) == NULL) goto dropfrag; |
| 295 | 294 | fp = mtod(t, struct ipq *); |
| ... | ... | @@ -357,11 +356,11 @@ insert: |
| 357 | 356 | for (q = fp->frag_link.next; q != (struct ipasfrag*)&fp->frag_link; |
| 358 | 357 | q = q->ipf_next) { |
| 359 | 358 | if (q->ipf_off != next) |
| 360 | - return (0); | |
| 359 | + return NULL; | |
| 361 | 360 | next += q->ipf_len; |
| 362 | 361 | } |
| 363 | 362 | if (((struct ipasfrag *)(q->ipf_prev))->ipf_tos & 1) |
| 364 | - return (0); | |
| 363 | + return NULL; | |
| 365 | 364 | |
| 366 | 365 | /* |
| 367 | 366 | * Reassembly is complete; concatenate fragments. |
| ... | ... | @@ -414,7 +413,7 @@ insert: |
| 414 | 413 | dropfrag: |
| 415 | 414 | STAT(ipstat.ips_fragdropped++); |
| 416 | 415 | m_freem(m); |
| 417 | - return (0); | |
| 416 | + return NULL; | |
| 418 | 417 | } |
| 419 | 418 | |
| 420 | 419 | /* |
| ... | ... | @@ -466,7 +465,7 @@ ip_deq(register struct ipasfrag *p) |
| 466 | 465 | * queue, discard it. |
| 467 | 466 | */ |
| 468 | 467 | void |
| 469 | -ip_slowtimo() | |
| 468 | +ip_slowtimo(void) | |
| 470 | 469 | { |
| 471 | 470 | struct qlink *l; |
| 472 | 471 | |
| ... | ... | @@ -474,7 +473,7 @@ ip_slowtimo() |
| 474 | 473 | |
| 475 | 474 | l = ipq.ip_link.next; |
| 476 | 475 | |
| 477 | - if (l == 0) | |
| 476 | + if (l == NULL) | |
| 478 | 477 | return; |
| 479 | 478 | |
| 480 | 479 | while (l != &ipq.ip_link) { |
| ... | ... | @@ -702,9 +701,7 @@ bad: |
| 702 | 701 | * (XXX) should be deleted; last arg currently ignored. |
| 703 | 702 | */ |
| 704 | 703 | void |
| 705 | -ip_stripoptions(m, mopt) | |
| 706 | - register struct mbuf *m; | |
| 707 | - struct mbuf *mopt; | |
| 704 | +ip_stripoptions(register struct mbuf *m, struct mbuf *mopt) | |
| 708 | 705 | { |
| 709 | 706 | register int i; |
| 710 | 707 | struct ip *ip = mtod(m, struct ip *); | ... | ... |
slirp/ip_output.c
| ... | ... | @@ -53,9 +53,7 @@ u_int16_t ip_id; |
| 53 | 53 | * The mbuf opt, if present, will not be freed. |
| 54 | 54 | */ |
| 55 | 55 | int |
| 56 | -ip_output(so, m0) | |
| 57 | - struct socket *so; | |
| 58 | - struct mbuf *m0; | |
| 56 | +ip_output(struct socket *so, struct mbuf *m0) | |
| 59 | 57 | { |
| 60 | 58 | register struct ip *ip; |
| 61 | 59 | register struct mbuf *m = m0; |
| ... | ... | @@ -135,7 +133,7 @@ ip_output(so, m0) |
| 135 | 133 | for (off = hlen + len; off < (u_int16_t)ip->ip_len; off += len) { |
| 136 | 134 | register struct ip *mhip; |
| 137 | 135 | m = m_get(); |
| 138 | - if (m == 0) { | |
| 136 | + if (m == NULL) { | |
| 139 | 137 | error = -1; |
| 140 | 138 | STAT(ipstat.ips_odropped++); |
| 141 | 139 | goto sendorfree; |
| ... | ... | @@ -185,7 +183,7 @@ ip_output(so, m0) |
| 185 | 183 | sendorfree: |
| 186 | 184 | for (m = m0; m; m = m0) { |
| 187 | 185 | m0 = m->m_nextpkt; |
| 188 | - m->m_nextpkt = 0; | |
| 186 | + m->m_nextpkt = NULL; | |
| 189 | 187 | if (error == 0) |
| 190 | 188 | if_output(so, m); |
| 191 | 189 | else | ... | ... |
slirp/libslirp.h
slirp/mbuf.c
| ... | ... | @@ -29,7 +29,7 @@ int mbuf_max = 0; |
| 29 | 29 | #define SLIRP_MSIZE (IF_MTU + IF_MAXLINKHDR + sizeof(struct m_hdr ) + 6) |
| 30 | 30 | |
| 31 | 31 | void |
| 32 | -m_init() | |
| 32 | +m_init(void) | |
| 33 | 33 | { |
| 34 | 34 | m_freelist.m_next = m_freelist.m_prev = &m_freelist; |
| 35 | 35 | m_usedlist.m_next = m_usedlist.m_prev = &m_usedlist; |
| ... | ... | @@ -44,7 +44,7 @@ m_init() |
| 44 | 44 | * which tells m_free to actually free() it |
| 45 | 45 | */ |
| 46 | 46 | struct mbuf * |
| 47 | -m_get() | |
| 47 | +m_get(void) | |
| 48 | 48 | { |
| 49 | 49 | register struct mbuf *m; |
| 50 | 50 | int flags = 0; |
| ... | ... | @@ -72,16 +72,15 @@ m_get() |
| 72 | 72 | m->m_size = SLIRP_MSIZE - sizeof(struct m_hdr); |
| 73 | 73 | m->m_data = m->m_dat; |
| 74 | 74 | m->m_len = 0; |
| 75 | - m->m_nextpkt = 0; | |
| 76 | - m->m_prevpkt = 0; | |
| 75 | + m->m_nextpkt = NULL; | |
| 76 | + m->m_prevpkt = NULL; | |
| 77 | 77 | end_error: |
| 78 | 78 | DEBUG_ARG("m = %lx", (long )m); |
| 79 | 79 | return m; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | void |
| 83 | -m_free(m) | |
| 84 | - struct mbuf *m; | |
| 83 | +m_free(struct mbuf *m) | |
| 85 | 84 | { |
| 86 | 85 | |
| 87 | 86 | DEBUG_CALL("m_free"); |
| ... | ... | @@ -115,8 +114,7 @@ m_free(m) |
| 115 | 114 | * an M_EXT data segment |
| 116 | 115 | */ |
| 117 | 116 | void |
| 118 | -m_cat(m, n) | |
| 119 | - register struct mbuf *m, *n; | |
| 117 | +m_cat(struct mbuf *m, struct mbuf *n) | |
| 120 | 118 | { |
| 121 | 119 | /* |
| 122 | 120 | * If there's no room, realloc |
| ... | ... | @@ -133,9 +131,7 @@ m_cat(m, n) |
| 133 | 131 | |
| 134 | 132 | /* make m size bytes large */ |
| 135 | 133 | void |
| 136 | -m_inc(m, size) | |
| 137 | - struct mbuf *m; | |
| 138 | - int size; | |
| 134 | +m_inc(struct mbuf *m, int size) | |
| 139 | 135 | { |
| 140 | 136 | int datasize; |
| 141 | 137 | |
| ... | ... | @@ -170,9 +166,7 @@ m_inc(m, size) |
| 170 | 166 | |
| 171 | 167 | |
| 172 | 168 | void |
| 173 | -m_adj(m, len) | |
| 174 | - struct mbuf *m; | |
| 175 | - int len; | |
| 169 | +m_adj(struct mbuf *m, int len) | |
| 176 | 170 | { |
| 177 | 171 | if (m == NULL) |
| 178 | 172 | return; |
| ... | ... | @@ -192,9 +186,7 @@ m_adj(m, len) |
| 192 | 186 | * Copy len bytes from m, starting off bytes into n |
| 193 | 187 | */ |
| 194 | 188 | int |
| 195 | -m_copy(n, m, off, len) | |
| 196 | - struct mbuf *n, *m; | |
| 197 | - int off, len; | |
| 189 | +m_copy(struct mbuf *n, struct mbuf *m, int off, int len) | |
| 198 | 190 | { |
| 199 | 191 | if (len > M_FREEROOM(n)) |
| 200 | 192 | return -1; |
| ... | ... | @@ -211,8 +203,7 @@ m_copy(n, m, off, len) |
| 211 | 203 | * Fortunately, it's not used often |
| 212 | 204 | */ |
| 213 | 205 | struct mbuf * |
| 214 | -dtom(dat) | |
| 215 | - void *dat; | |
| 206 | +dtom(void *dat) | |
| 216 | 207 | { |
| 217 | 208 | struct mbuf *m; |
| 218 | 209 | ... | ... |
slirp/misc.c
| ... | ... | @@ -70,7 +70,7 @@ redir_x(inaddr, start_port, display, screen) |
| 70 | 70 | * Get our IP address and put it in our_addr |
| 71 | 71 | */ |
| 72 | 72 | void |
| 73 | -getouraddr() | |
| 73 | +getouraddr(void) | |
| 74 | 74 | { |
| 75 | 75 | char buff[256]; |
| 76 | 76 | struct hostent *he = NULL; |
| ... | ... | @@ -89,8 +89,7 @@ struct quehead { |
| 89 | 89 | }; |
| 90 | 90 | |
| 91 | 91 | inline void |
| 92 | -insque(a, b) | |
| 93 | - void *a, *b; | |
| 92 | +insque(void *a, void *b) | |
| 94 | 93 | { |
| 95 | 94 | register struct quehead *element = (struct quehead *) a; |
| 96 | 95 | register struct quehead *head = (struct quehead *) b; |
| ... | ... | @@ -102,8 +101,7 @@ insque(a, b) |
| 102 | 101 | } |
| 103 | 102 | |
| 104 | 103 | inline void |
| 105 | -remque(a) | |
| 106 | - void *a; | |
| 104 | +remque(void *a) | |
| 107 | 105 | { |
| 108 | 106 | register struct quehead *element = (struct quehead *) a; |
| 109 | 107 | ((struct quehead *)(element->qh_link))->qh_rlink = element->qh_rlink; |
| ... | ... | @@ -116,12 +114,7 @@ remque(a) |
| 116 | 114 | |
| 117 | 115 | |
| 118 | 116 | int |
| 119 | -add_exec(ex_ptr, do_pty, exec, addr, port) | |
| 120 | - struct ex_list **ex_ptr; | |
| 121 | - int do_pty; | |
| 122 | - char *exec; | |
| 123 | - int addr; | |
| 124 | - int port; | |
| 117 | +add_exec(struct ex_list **ex_ptr, int do_pty, char *exec, int addr, int port) | |
| 125 | 118 | { |
| 126 | 119 | struct ex_list *tmp_ptr; |
| 127 | 120 | |
| ... | ... | @@ -363,7 +356,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty) |
| 363 | 356 | argv[i++] = strdup(curarg); |
| 364 | 357 | } while (c); |
| 365 | 358 | |
| 366 | - argv[i] = 0; | |
| 359 | + argv[i] = NULL; | |
| 367 | 360 | execvp(argv[0], (char **)argv); |
| 368 | 361 | |
| 369 | 362 | /* Ooops, failed, let's tell the user why */ |
| ... | ... | @@ -402,9 +395,9 @@ fork_exec(struct socket *so, const char *ex, int do_pty) |
| 402 | 395 | fd_nonblock(so->s); |
| 403 | 396 | |
| 404 | 397 | /* Append the telnet options now */ |
| 405 | - if (so->so_m != 0 && do_pty == 1) { | |
| 398 | + if (so->so_m != NULL && do_pty == 1) { | |
| 406 | 399 | sbappend(so, so->so_m); |
| 407 | - so->so_m = 0; | |
| 400 | + so->so_m = NULL; | |
| 408 | 401 | } |
| 409 | 402 | |
| 410 | 403 | return 1; |
| ... | ... | @@ -764,8 +757,7 @@ sprintf_len(va_alist) va_dcl |
| 764 | 757 | #endif |
| 765 | 758 | |
| 766 | 759 | void |
| 767 | -u_sleep(usec) | |
| 768 | - int usec; | |
| 760 | +u_sleep(int usec) | |
| 769 | 761 | { |
| 770 | 762 | struct timeval t; |
| 771 | 763 | fd_set fdset; |
| ... | ... | @@ -783,8 +775,7 @@ u_sleep(usec) |
| 783 | 775 | */ |
| 784 | 776 | |
| 785 | 777 | void |
| 786 | -fd_nonblock(fd) | |
| 787 | - int fd; | |
| 778 | +fd_nonblock(int fd) | |
| 788 | 779 | { |
| 789 | 780 | #ifdef FIONBIO |
| 790 | 781 | int opt = 1; |
| ... | ... | @@ -800,8 +791,7 @@ fd_nonblock(fd) |
| 800 | 791 | } |
| 801 | 792 | |
| 802 | 793 | void |
| 803 | -fd_block(fd) | |
| 804 | - int fd; | |
| 794 | +fd_block(int fd) | |
| 805 | 795 | { |
| 806 | 796 | #ifdef FIONBIO |
| 807 | 797 | int opt = 0; | ... | ... |
slirp/sbuf.c
| ... | ... | @@ -18,16 +18,13 @@ static void sbappendsb(struct sbuf *sb, struct mbuf *m); |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | void |
| 21 | -sbfree(sb) | |
| 22 | - struct sbuf *sb; | |
| 21 | +sbfree(struct sbuf *sb) | |
| 23 | 22 | { |
| 24 | 23 | free(sb->sb_data); |
| 25 | 24 | } |
| 26 | 25 | |
| 27 | 26 | void |
| 28 | -sbdrop(sb, num) | |
| 29 | - struct sbuf *sb; | |
| 30 | - int num; | |
| 27 | +sbdrop(struct sbuf *sb, int num) | |
| 31 | 28 | { |
| 32 | 29 | /* |
| 33 | 30 | * We can only drop how much we have |
| ... | ... | @@ -43,9 +40,7 @@ sbdrop(sb, num) |
| 43 | 40 | } |
| 44 | 41 | |
| 45 | 42 | void |
| 46 | -sbreserve(sb, size) | |
| 47 | - struct sbuf *sb; | |
| 48 | - int size; | |
| 43 | +sbreserve(struct sbuf *sb, int size) | |
| 49 | 44 | { |
| 50 | 45 | if (sb->sb_data) { |
| 51 | 46 | /* Already alloced, realloc if necessary */ |
| ... | ... | @@ -74,9 +69,7 @@ sbreserve(sb, size) |
| 74 | 69 | * (the socket is non-blocking, so we won't hang) |
| 75 | 70 | */ |
| 76 | 71 | void |
| 77 | -sbappend(so, m) | |
| 78 | - struct socket *so; | |
| 79 | - struct mbuf *m; | |
| 72 | +sbappend(struct socket *so, struct mbuf *m) | |
| 80 | 73 | { |
| 81 | 74 | int ret = 0; |
| 82 | 75 | |
| ... | ... | @@ -173,11 +166,7 @@ sbappendsb(struct sbuf *sb, struct mbuf *m) |
| 173 | 166 | * done in sbdrop when the data is acked |
| 174 | 167 | */ |
| 175 | 168 | void |
| 176 | -sbcopy(sb, off, len, to) | |
| 177 | - struct sbuf *sb; | |
| 178 | - int off; | |
| 179 | - int len; | |
| 180 | - char *to; | |
| 169 | +sbcopy(struct sbuf *sb, int off, int len, char *to) | |
| 181 | 170 | { |
| 182 | 171 | char *from; |
| 183 | 172 | ... | ... |
slirp/slirp.c
| ... | ... | @@ -50,7 +50,7 @@ static const uint8_t zero_ethaddr[6] = { 0, 0, 0, 0, 0, 0 }; |
| 50 | 50 | |
| 51 | 51 | const char *slirp_special_ip = CTL_SPECIAL; |
| 52 | 52 | int slirp_restrict; |
| 53 | -int do_slowtimo; | |
| 53 | +static int do_slowtimo; | |
| 54 | 54 | int link_up; |
| 55 | 55 | struct timeval tt; |
| 56 | 56 | FILE *lfd; |
| ... | ... | @@ -171,7 +171,7 @@ static void slirp_cleanup(void) |
| 171 | 171 | static void slirp_state_save(QEMUFile *f, void *opaque); |
| 172 | 172 | static int slirp_state_load(QEMUFile *f, void *opaque, int version_id); |
| 173 | 173 | |
| 174 | -void slirp_init(int restrict, char *special_ip) | |
| 174 | +void slirp_init(int restricted, char *special_ip) | |
| 175 | 175 | { |
| 176 | 176 | // debug_init("/tmp/slirp.log", DEBUG_DEFAULT); |
| 177 | 177 | |
| ... | ... | @@ -184,7 +184,7 @@ void slirp_init(int restrict, char *special_ip) |
| 184 | 184 | #endif |
| 185 | 185 | |
| 186 | 186 | link_up = 1; |
| 187 | - slirp_restrict = restrict; | |
| 187 | + slirp_restrict = restricted; | |
| 188 | 188 | |
| 189 | 189 | if_init(); |
| 190 | 190 | ip_init(); |
| ... | ... | @@ -228,7 +228,7 @@ static void updtime(void) |
| 228 | 228 | #else |
| 229 | 229 | static void updtime(void) |
| 230 | 230 | { |
| 231 | - gettimeofday(&tt, 0); | |
| 231 | + gettimeofday(&tt, NULL); | |
| 232 | 232 | |
| 233 | 233 | curtime = (u_int)tt.tv_sec * (u_int)1000; |
| 234 | 234 | curtime += (u_int)tt.tv_usec / (u_int)1000; | ... | ... |
slirp/socket.c
| ... | ... | @@ -25,12 +25,8 @@ so_init() |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | 27 | struct socket * |
| 28 | -solookup(head, laddr, lport, faddr, fport) | |
| 29 | - struct socket *head; | |
| 30 | - struct in_addr laddr; | |
| 31 | - u_int lport; | |
| 32 | - struct in_addr faddr; | |
| 33 | - u_int fport; | |
| 28 | +solookup(struct socket *head, struct in_addr laddr, u_int lport, | |
| 29 | + struct in_addr faddr, u_int fport) | |
| 34 | 30 | { |
| 35 | 31 | struct socket *so; |
| 36 | 32 | |
| ... | ... | @@ -54,7 +50,7 @@ solookup(head, laddr, lport, faddr, fport) |
| 54 | 50 | * insque() it into the correct linked-list |
| 55 | 51 | */ |
| 56 | 52 | struct socket * |
| 57 | -socreate() | |
| 53 | +socreate(void) | |
| 58 | 54 | { |
| 59 | 55 | struct socket *so; |
| 60 | 56 | |
| ... | ... | @@ -71,8 +67,7 @@ socreate() |
| 71 | 67 | * remque and free a socket, clobber cache |
| 72 | 68 | */ |
| 73 | 69 | void |
| 74 | -sofree(so) | |
| 75 | - struct socket *so; | |
| 70 | +sofree(struct socket *so) | |
| 76 | 71 | { |
| 77 | 72 | if (so->so_emu==EMU_RSH && so->extra) { |
| 78 | 73 | sofree(so->extra); |
| ... | ... | @@ -158,8 +153,7 @@ size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np) |
| 158 | 153 | * a read() of 0 (or less) means it's disconnected |
| 159 | 154 | */ |
| 160 | 155 | int |
| 161 | -soread(so) | |
| 162 | - struct socket *so; | |
| 156 | +soread(struct socket *so) | |
| 163 | 157 | { |
| 164 | 158 | int n, nn; |
| 165 | 159 | struct sbuf *sb = &so->so_snd; |
| ... | ... | @@ -269,8 +263,7 @@ err: |
| 269 | 263 | * in the send buffer is sent as urgent data |
| 270 | 264 | */ |
| 271 | 265 | void |
| 272 | -sorecvoob(so) | |
| 273 | - struct socket *so; | |
| 266 | +sorecvoob(struct socket *so) | |
| 274 | 267 | { |
| 275 | 268 | struct tcpcb *tp = sototcpcb(so); |
| 276 | 269 | |
| ... | ... | @@ -297,8 +290,7 @@ sorecvoob(so) |
| 297 | 290 | * There's a lot duplicated code here, but... |
| 298 | 291 | */ |
| 299 | 292 | int |
| 300 | -sosendoob(so) | |
| 301 | - struct socket *so; | |
| 293 | +sosendoob(struct socket *so) | |
| 302 | 294 | { |
| 303 | 295 | struct sbuf *sb = &so->so_rcv; |
| 304 | 296 | char buff[2048]; /* XXX Shouldn't be sending more oob data than this */ |
| ... | ... | @@ -356,8 +348,7 @@ sosendoob(so) |
| 356 | 348 | * updating all sbuf field as necessary |
| 357 | 349 | */ |
| 358 | 350 | int |
| 359 | -sowrite(so) | |
| 360 | - struct socket *so; | |
| 351 | +sowrite(struct socket *so) | |
| 361 | 352 | { |
| 362 | 353 | int n,nn; |
| 363 | 354 | struct sbuf *sb = &so->so_rcv; |
| ... | ... | @@ -451,8 +442,7 @@ sowrite(so) |
| 451 | 442 | * recvfrom() a UDP socket |
| 452 | 443 | */ |
| 453 | 444 | void |
| 454 | -sorecvfrom(so) | |
| 455 | - struct socket *so; | |
| 445 | +sorecvfrom(struct socket *so) | |
| 456 | 446 | { |
| 457 | 447 | struct sockaddr_in addr; |
| 458 | 448 | socklen_t addrlen = sizeof(struct sockaddr_in); |
| ... | ... | @@ -479,7 +469,7 @@ sorecvfrom(so) |
| 479 | 469 | icmp_error(so->so_m, ICMP_UNREACH,code, 0,strerror(errno)); |
| 480 | 470 | } else { |
| 481 | 471 | icmp_reflect(so->so_m); |
| 482 | - so->so_m = 0; /* Don't m_free() it again! */ | |
| 472 | + so->so_m = NULL; /* Don't m_free() it again! */ | |
| 483 | 473 | } |
| 484 | 474 | /* No need for this socket anymore, udp_detach it */ |
| 485 | 475 | udp_detach(so); |
| ... | ... | @@ -551,9 +541,7 @@ sorecvfrom(so) |
| 551 | 541 | * sendto() a socket |
| 552 | 542 | */ |
| 553 | 543 | int |
| 554 | -sosendto(so, m) | |
| 555 | - struct socket *so; | |
| 556 | - struct mbuf *m; | |
| 544 | +sosendto(struct socket *so, struct mbuf *m) | |
| 557 | 545 | { |
| 558 | 546 | int ret; |
| 559 | 547 | struct sockaddr_in addr; |
| ... | ... | @@ -600,11 +588,7 @@ sosendto(so, m) |
| 600 | 588 | * XXX This should really be tcp_listen |
| 601 | 589 | */ |
| 602 | 590 | struct socket * |
| 603 | -solisten(port, laddr, lport, flags) | |
| 604 | - u_int port; | |
| 605 | - u_int32_t laddr; | |
| 606 | - u_int lport; | |
| 607 | - int flags; | |
| 591 | +solisten(u_int port, u_int32_t laddr, u_int lport, int flags) | |
| 608 | 592 | { |
| 609 | 593 | struct sockaddr_in addr; |
| 610 | 594 | struct socket *so; |
| ... | ... | @@ -706,8 +690,7 @@ sowwakeup(so) |
| 706 | 690 | * times each when only 1 was needed |
| 707 | 691 | */ |
| 708 | 692 | void |
| 709 | -soisfconnecting(so) | |
| 710 | - register struct socket *so; | |
| 693 | +soisfconnecting(struct socket *so) | |
| 711 | 694 | { |
| 712 | 695 | so->so_state &= ~(SS_NOFDREF|SS_ISFCONNECTED|SS_FCANTRCVMORE| |
| 713 | 696 | SS_FCANTSENDMORE|SS_FWDRAIN); |
| ... | ... | @@ -715,8 +698,7 @@ soisfconnecting(so) |
| 715 | 698 | } |
| 716 | 699 | |
| 717 | 700 | void |
| 718 | -soisfconnected(so) | |
| 719 | - register struct socket *so; | |
| 701 | +soisfconnected(struct socket *so) | |
| 720 | 702 | { |
| 721 | 703 | so->so_state &= ~(SS_ISFCONNECTING|SS_FWDRAIN|SS_NOFDREF); |
| 722 | 704 | so->so_state |= SS_ISFCONNECTED; /* Clobber other states */ |
| ... | ... | @@ -758,8 +740,7 @@ sofcantsendmore(struct socket *so) |
| 758 | 740 | } |
| 759 | 741 | |
| 760 | 742 | void |
| 761 | -soisfdisconnected(so) | |
| 762 | - struct socket *so; | |
| 743 | +soisfdisconnected(struct socket *so) | |
| 763 | 744 | { |
| 764 | 745 | /* so->so_state &= ~(SS_ISFCONNECTING|SS_ISFCONNECTED); */ |
| 765 | 746 | /* close(so->s); */ |
| ... | ... | @@ -774,8 +755,7 @@ soisfdisconnected(so) |
| 774 | 755 | * Set CANTSENDMORE once all data has been write()n |
| 775 | 756 | */ |
| 776 | 757 | void |
| 777 | -sofwdrain(so) | |
| 778 | - struct socket *so; | |
| 758 | +sofwdrain(struct socket *so) | |
| 779 | 759 | { |
| 780 | 760 | if (so->so_rcv.sb_cc) |
| 781 | 761 | so->so_state |= SS_FWDRAIN; | ... | ... |
slirp/tcp_input.c
| ... | ... | @@ -121,10 +121,10 @@ tcp_reass(register struct tcpcb *tp, register struct tcpiphdr *ti, |
| 121 | 121 | int flags; |
| 122 | 122 | |
| 123 | 123 | /* |
| 124 | - * Call with ti==0 after become established to | |
| 124 | + * Call with ti==NULL after become established to | |
| 125 | 125 | * force pre-ESTABLISHED data up to user socket. |
| 126 | 126 | */ |
| 127 | - if (ti == 0) | |
| 127 | + if (ti == NULL) | |
| 128 | 128 | goto present; |
| 129 | 129 | |
| 130 | 130 | /* |
| ... | ... | @@ -230,19 +230,16 @@ present: |
| 230 | 230 | * protocol specification dated September, 1981 very closely. |
| 231 | 231 | */ |
| 232 | 232 | void |
| 233 | -tcp_input(m, iphlen, inso) | |
| 234 | - register struct mbuf *m; | |
| 235 | - int iphlen; | |
| 236 | - struct socket *inso; | |
| 233 | +tcp_input(struct mbuf *m, int iphlen, struct socket *inso) | |
| 237 | 234 | { |
| 238 | 235 | struct ip save_ip, *ip; |
| 239 | 236 | register struct tcpiphdr *ti; |
| 240 | 237 | caddr_t optp = NULL; |
| 241 | 238 | int optlen = 0; |
| 242 | 239 | int len, tlen, off; |
| 243 | - register struct tcpcb *tp = 0; | |
| 240 | + register struct tcpcb *tp = NULL; | |
| 244 | 241 | register int tiflags; |
| 245 | - struct socket *so = 0; | |
| 242 | + struct socket *so = NULL; | |
| 246 | 243 | int todrop, acked, ourfinisacked, needoutput = 0; |
| 247 | 244 | /* int dropsocket = 0; */ |
| 248 | 245 | int iss = 0; |
| ... | ... | @@ -264,7 +261,7 @@ tcp_input(m, iphlen, inso) |
| 264 | 261 | /* Re-set a few variables */ |
| 265 | 262 | tp = sototcpcb(so); |
| 266 | 263 | m = so->so_m; |
| 267 | - so->so_m = 0; | |
| 264 | + so->so_m = NULL; | |
| 268 | 265 | ti = so->so_ti; |
| 269 | 266 | tiwin = ti->ti_win; |
| 270 | 267 | tiflags = ti->ti_flags; |
| ... | ... | @@ -298,8 +295,8 @@ tcp_input(m, iphlen, inso) |
| 298 | 295 | * Checksum extended TCP header and data. |
| 299 | 296 | */ |
| 300 | 297 | tlen = ((struct ip *)ti)->ip_len; |
| 301 | - tcpiphdr2qlink(ti)->next = tcpiphdr2qlink(ti)->prev = 0; | |
| 302 | - memset(&ti->ti_i.ih_mbuf, 0 , sizeof(struct mbuf_ptr)); | |
| 298 | + tcpiphdr2qlink(ti)->next = tcpiphdr2qlink(ti)->prev = NULL; | |
| 299 | + memset(&ti->ti_i.ih_mbuf, 0 , sizeof(struct mbuf_ptr)); | |
| 303 | 300 | ti->ti_x1 = 0; |
| 304 | 301 | ti->ti_len = htons((u_int16_t)tlen); |
| 305 | 302 | len = sizeof(struct ip ) + tlen; |
| ... | ... | @@ -399,7 +396,7 @@ findso: |
| 399 | 396 | * the only flag set, then create a session, mark it |
| 400 | 397 | * as if it was LISTENING, and continue... |
| 401 | 398 | */ |
| 402 | - if (so == 0) { | |
| 399 | + if (so == NULL) { | |
| 403 | 400 | if ((tiflags & (TH_SYN|TH_FIN|TH_RST|TH_URG|TH_ACK)) != TH_SYN) |
| 404 | 401 | goto dropwithreset; |
| 405 | 402 | |
| ... | ... | @@ -439,7 +436,7 @@ findso: |
| 439 | 436 | tp = sototcpcb(so); |
| 440 | 437 | |
| 441 | 438 | /* XXX Should never fail */ |
| 442 | - if (tp == 0) | |
| 439 | + if (tp == NULL) | |
| 443 | 440 | goto dropwithreset; |
| 444 | 441 | if (tp->t_state == TCPS_CLOSED) |
| 445 | 442 | goto drop; |
| ... | ... | @@ -1697,9 +1694,7 @@ tcp_xmit_timer(register struct tcpcb *tp, int rtt) |
| 1697 | 1694 | */ |
| 1698 | 1695 | |
| 1699 | 1696 | int |
| 1700 | -tcp_mss(tp, offer) | |
| 1701 | - register struct tcpcb *tp; | |
| 1702 | - u_int offer; | |
| 1697 | +tcp_mss(struct tcpcb *tp, u_int offer) | |
| 1703 | 1698 | { |
| 1704 | 1699 | struct socket *so = tp->t_socket; |
| 1705 | 1700 | int mss; | ... | ... |
slirp/tcp_output.c
| ... | ... | @@ -64,8 +64,7 @@ static const u_char tcp_outflags[TCP_NSTATES] = { |
| 64 | 64 | * Tcp output routine: figure out what should be sent and send it. |
| 65 | 65 | */ |
| 66 | 66 | int |
| 67 | -tcp_output(tp) | |
| 68 | - register struct tcpcb *tp; | |
| 67 | +tcp_output(struct tcpcb *tp) | |
| 69 | 68 | { |
| 70 | 69 | register struct socket *so = tp->t_socket; |
| 71 | 70 | register long len, win; |
| ... | ... | @@ -582,8 +581,7 @@ out: |
| 582 | 581 | } |
| 583 | 582 | |
| 584 | 583 | void |
| 585 | -tcp_setpersist(tp) | |
| 586 | - register struct tcpcb *tp; | |
| 584 | +tcp_setpersist(struct tcpcb *tp) | |
| 587 | 585 | { |
| 588 | 586 | int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1; |
| 589 | 587 | ... | ... |
slirp/tcp_subr.c
| ... | ... | @@ -49,7 +49,7 @@ |
| 49 | 49 | * Tcp initialization |
| 50 | 50 | */ |
| 51 | 51 | void |
| 52 | -tcp_init() | |
| 52 | +tcp_init(void) | |
| 53 | 53 | { |
| 54 | 54 | tcp_iss = 1; /* wrong */ |
| 55 | 55 | tcb.so_next = tcb.so_prev = &tcb; |
| ... | ... | @@ -63,8 +63,7 @@ tcp_init() |
| 63 | 63 | */ |
| 64 | 64 | /* struct tcpiphdr * */ |
| 65 | 65 | void |
| 66 | -tcp_template(tp) | |
| 67 | - struct tcpcb *tp; | |
| 66 | +tcp_template(struct tcpcb *tp) | |
| 68 | 67 | { |
| 69 | 68 | struct socket *so = tp->t_socket; |
| 70 | 69 | register struct tcpiphdr *n = &tp->t_template; |
| ... | ... | @@ -102,12 +101,8 @@ tcp_template(tp) |
| 102 | 101 | * segment are as specified by the parameters. |
| 103 | 102 | */ |
| 104 | 103 | void |
| 105 | -tcp_respond(tp, ti, m, ack, seq, flags) | |
| 106 | - struct tcpcb *tp; | |
| 107 | - register struct tcpiphdr *ti; | |
| 108 | - register struct mbuf *m; | |
| 109 | - tcp_seq ack, seq; | |
| 110 | - int flags; | |
| 104 | +tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m, | |
| 105 | + tcp_seq ack, tcp_seq seq, int flags) | |
| 111 | 106 | { |
| 112 | 107 | register int tlen; |
| 113 | 108 | int win = 0; |
| ... | ... | @@ -122,7 +117,7 @@ tcp_respond(tp, ti, m, ack, seq, flags) |
| 122 | 117 | |
| 123 | 118 | if (tp) |
| 124 | 119 | win = sbspace(&tp->t_socket->so_rcv); |
| 125 | - if (m == 0) { | |
| 120 | + if (m == NULL) { | |
| 126 | 121 | if ((m = m_get()) == NULL) |
| 127 | 122 | return; |
| 128 | 123 | #ifdef TCP_COMPAT_42 |
| ... | ... | @@ -152,7 +147,7 @@ tcp_respond(tp, ti, m, ack, seq, flags) |
| 152 | 147 | tlen += sizeof (struct tcpiphdr); |
| 153 | 148 | m->m_len = tlen; |
| 154 | 149 | |
| 155 | - ti->ti_mbuf = 0; | |
| 150 | + ti->ti_mbuf = NULL; | |
| 156 | 151 | ti->ti_x1 = 0; |
| 157 | 152 | ti->ti_seq = htonl(seq); |
| 158 | 153 | ti->ti_ack = htonl(ack); |
| ... | ... | @@ -182,8 +177,7 @@ tcp_respond(tp, ti, m, ack, seq, flags) |
| 182 | 177 | * protocol control block. |
| 183 | 178 | */ |
| 184 | 179 | struct tcpcb * |
| 185 | -tcp_newtcpcb(so) | |
| 186 | - struct socket *so; | |
| 180 | +tcp_newtcpcb(struct socket *so) | |
| 187 | 181 | { |
| 188 | 182 | register struct tcpcb *tp; |
| 189 | 183 | |
| ... | ... | @@ -257,8 +251,7 @@ struct tcpcb *tcp_drop(struct tcpcb *tp, int err) |
| 257 | 251 | * wake up any sleepers |
| 258 | 252 | */ |
| 259 | 253 | struct tcpcb * |
| 260 | -tcp_close(tp) | |
| 261 | - register struct tcpcb *tp; | |
| 254 | +tcp_close(struct tcpcb *tp) | |
| 262 | 255 | { |
| 263 | 256 | register struct tcpiphdr *t; |
| 264 | 257 | struct socket *so = tp->t_socket; |
| ... | ... | @@ -281,7 +274,7 @@ tcp_close(tp) |
| 281 | 274 | */ |
| 282 | 275 | /* free(tp, M_PCB); */ |
| 283 | 276 | free(tp); |
| 284 | - so->so_tcpcb = 0; | |
| 277 | + so->so_tcpcb = NULL; | |
| 285 | 278 | soisfdisconnected(so); |
| 286 | 279 | /* clobber input socket cache if we're closing the cached connection */ |
| 287 | 280 | if (so == tcp_last_so) |
| ... | ... | @@ -333,8 +326,7 @@ tcp_quench(i, errno) |
| 333 | 326 | * We can let the user exit from the close as soon as the FIN is acked. |
| 334 | 327 | */ |
| 335 | 328 | void |
| 336 | -tcp_sockclosed(tp) | |
| 337 | - struct tcpcb *tp; | |
| 329 | +tcp_sockclosed(struct tcpcb *tp) | |
| 338 | 330 | { |
| 339 | 331 | |
| 340 | 332 | DEBUG_CALL("tcp_sockclosed"); |
| ... | ... | @@ -375,8 +367,7 @@ tcp_sockclosed(tp) |
| 375 | 367 | * nonblocking. Connect returns after the SYN is sent, and does |
| 376 | 368 | * not wait for ACK+SYN. |
| 377 | 369 | */ |
| 378 | -int tcp_fconnect(so) | |
| 379 | - struct socket *so; | |
| 370 | +int tcp_fconnect(struct socket *so) | |
| 380 | 371 | { |
| 381 | 372 | int ret=0; |
| 382 | 373 | |
| ... | ... | @@ -438,8 +429,7 @@ int tcp_fconnect(so) |
| 438 | 429 | * here and SYN the local-host. |
| 439 | 430 | */ |
| 440 | 431 | void |
| 441 | -tcp_connect(inso) | |
| 442 | - struct socket *inso; | |
| 432 | +tcp_connect(struct socket *inso) | |
| 443 | 433 | { |
| 444 | 434 | struct socket *so; |
| 445 | 435 | struct sockaddr_in addr; |
| ... | ... | @@ -525,8 +515,7 @@ tcp_connect(inso) |
| 525 | 515 | * Attach a TCPCB to a socket. |
| 526 | 516 | */ |
| 527 | 517 | int |
| 528 | -tcp_attach(so) | |
| 529 | - struct socket *so; | |
| 518 | +tcp_attach(struct socket *so) | |
| 530 | 519 | { |
| 531 | 520 | if ((so->so_tcpcb = tcp_newtcpcb(so)) == NULL) |
| 532 | 521 | return -1; |
| ... | ... | @@ -558,14 +547,13 @@ static const struct tos_t tcptos[] = { |
| 558 | 547 | #ifdef CONFIG_QEMU |
| 559 | 548 | static |
| 560 | 549 | #endif |
| 561 | -struct emu_t *tcpemu = 0; | |
| 550 | +struct emu_t *tcpemu = NULL; | |
| 562 | 551 | |
| 563 | 552 | /* |
| 564 | 553 | * Return TOS according to the above table |
| 565 | 554 | */ |
| 566 | 555 | u_int8_t |
| 567 | -tcp_tos(so) | |
| 568 | - struct socket *so; | |
| 556 | +tcp_tos(struct socket *so) | |
| 569 | 557 | { |
| 570 | 558 | int i = 0; |
| 571 | 559 | struct emu_t *emup; |
| ... | ... | @@ -620,9 +608,7 @@ int do_echo = -1; |
| 620 | 608 | * NOTE: if you return 0 you MUST m_free() the mbuf! |
| 621 | 609 | */ |
| 622 | 610 | int |
| 623 | -tcp_emu(so, m) | |
| 624 | - struct socket *so; | |
| 625 | - struct mbuf *m; | |
| 611 | +tcp_emu(struct socket *so, struct mbuf *m) | |
| 626 | 612 | { |
| 627 | 613 | u_int n1, n2, n3, n4, n5, n6; |
| 628 | 614 | char buff[257]; |
| ... | ... | @@ -976,7 +962,7 @@ do_prompt: |
| 976 | 962 | } |
| 977 | 963 | #endif |
| 978 | 964 | case EMU_FTP: /* ftp */ |
| 979 | - *(m->m_data+m->m_len) = 0; /* NULL terminate for strstr */ | |
| 965 | + *(m->m_data+m->m_len) = 0; /* NUL terminate for strstr */ | |
| 980 | 966 | if ((bptr = (char *)strstr(m->m_data, "ORT")) != NULL) { |
| 981 | 967 | /* |
| 982 | 968 | * Need to emulate the PORT command |
| ... | ... | @@ -1244,8 +1230,7 @@ do_prompt: |
| 1244 | 1230 | * return 2 if this is a command-line connection |
| 1245 | 1231 | */ |
| 1246 | 1232 | int |
| 1247 | -tcp_ctl(so) | |
| 1248 | - struct socket *so; | |
| 1233 | +tcp_ctl(struct socket *so) | |
| 1249 | 1234 | { |
| 1250 | 1235 | struct sbuf *sb = &so->so_snd; |
| 1251 | 1236 | int command; | ... | ... |
vl.c
| ... | ... | @@ -21,29 +21,6 @@ |
| 21 | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | 22 | * THE SOFTWARE. |
| 23 | 23 | */ |
| 24 | -#include "hw/hw.h" | |
| 25 | -#include "hw/boards.h" | |
| 26 | -#include "hw/usb.h" | |
| 27 | -#include "hw/pcmcia.h" | |
| 28 | -#include "hw/pc.h" | |
| 29 | -#include "hw/audiodev.h" | |
| 30 | -#include "hw/isa.h" | |
| 31 | -#include "hw/baum.h" | |
| 32 | -#include "hw/bt.h" | |
| 33 | -#include "net.h" | |
| 34 | -#include "monitor.h" | |
| 35 | -#include "console.h" | |
| 36 | -#include "sysemu.h" | |
| 37 | -#include "gdbstub.h" | |
| 38 | -#include "qemu-timer.h" | |
| 39 | -#include "qemu-char.h" | |
| 40 | -#include "cache-utils.h" | |
| 41 | -#include "block.h" | |
| 42 | -#include "audio/audio.h" | |
| 43 | -#include "migration.h" | |
| 44 | -#include "kvm.h" | |
| 45 | -#include "balloon.h" | |
| 46 | - | |
| 47 | 24 | #include <unistd.h> |
| 48 | 25 | #include <fcntl.h> |
| 49 | 26 | #include <signal.h> |
| ... | ... | @@ -114,12 +91,6 @@ |
| 114 | 91 | #endif |
| 115 | 92 | #endif |
| 116 | 93 | |
| 117 | -#include "qemu_socket.h" | |
| 118 | - | |
| 119 | -#if defined(CONFIG_SLIRP) | |
| 120 | -#include "libslirp.h" | |
| 121 | -#endif | |
| 122 | - | |
| 123 | 94 | #if defined(__OpenBSD__) |
| 124 | 95 | #include <util.h> |
| 125 | 96 | #endif |
| ... | ... | @@ -154,10 +125,39 @@ int main(int argc, char **argv) |
| 154 | 125 | #define main qemu_main |
| 155 | 126 | #endif /* CONFIG_COCOA */ |
| 156 | 127 | |
| 128 | +#include "hw/hw.h" | |
| 129 | +#include "hw/boards.h" | |
| 130 | +#include "hw/usb.h" | |
| 131 | +#include "hw/pcmcia.h" | |
| 132 | +#include "hw/pc.h" | |
| 133 | +#include "hw/audiodev.h" | |
| 134 | +#include "hw/isa.h" | |
| 135 | +#include "hw/baum.h" | |
| 136 | +#include "hw/bt.h" | |
| 137 | +#include "net.h" | |
| 138 | +#include "monitor.h" | |
| 139 | +#include "console.h" | |
| 140 | +#include "sysemu.h" | |
| 141 | +#include "gdbstub.h" | |
| 142 | +#include "qemu-timer.h" | |
| 143 | +#include "qemu-char.h" | |
| 144 | +#include "cache-utils.h" | |
| 145 | +#include "block.h" | |
| 146 | +#include "audio/audio.h" | |
| 147 | +#include "migration.h" | |
| 148 | +#include "kvm.h" | |
| 149 | +#include "balloon.h" | |
| 150 | + | |
| 157 | 151 | #include "disas.h" |
| 158 | 152 | |
| 159 | 153 | #include "exec-all.h" |
| 160 | 154 | |
| 155 | +#include "qemu_socket.h" | |
| 156 | + | |
| 157 | +#if defined(CONFIG_SLIRP) | |
| 158 | +#include "libslirp.h" | |
| 159 | +#endif | |
| 160 | + | |
| 161 | 161 | //#define DEBUG_UNUSED_IOPORT |
| 162 | 162 | //#define DEBUG_IOPORT |
| 163 | 163 | //#define DEBUG_NET | ... | ... |