Changeset 4d86e06


Ignore:
Timestamp:
Jul 23, 2009, 12:53:57 AM (12 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
ba6c8bd
Parents:
029a8b5
Message:
Get rid of a whole bunch of useless casts.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • aim.c

    r029a8b5 r4d86e06  
    346346  aim_conn_t *cur;
    347347  /*
    348   OscarData *od = (OscarData *)g->proto_data;
     348  OscarData *od = g->proto_data;
    349349  char *name, *exchange;
    350350  */
     
    429429
    430430  aimsess=owl_global_get_aimsess(&g);
    431   priv = (struct owlfaim_priv *)aimsess->aux_data;
     431  priv = aimsess->aux_data;
    432432
    433433  /* do a select without blocking */
     
    479479static int faimtest_parse_login(aim_session_t *sess, aim_frame_t *fr, ...)
    480480{
    481   struct owlfaim_priv *priv = (struct owlfaim_priv *)sess->aux_data;
     481  struct owlfaim_priv *priv = sess->aux_data;
    482482  struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD;
    483483   
     
    703703static int faimtest_parse_connerr(aim_session_t *sess, aim_frame_t *fr, ...)
    704704{
    705   struct owlfaim_priv *priv = (struct owlfaim_priv *)sess->aux_data;
     705  struct owlfaim_priv *priv = sess->aux_data;
    706706  va_list ap;
    707707  fu16_t code;
     
    879879static int faimtest_reportinterval(aim_session_t *sess, aim_frame_t *fr, ...)
    880880{
    881   struct owlfaim_priv *priv = (struct owlfaim_priv *)sess->aux_data;
     881  struct owlfaim_priv *priv = sess->aux_data;
    882882  va_list ap;
    883883  fu16_t interval;
     
    944944static int getaimdata(aim_session_t *sess, unsigned char **bufret, int *buflenret, unsigned long offset, unsigned long len, const char *modname)
    945945{
    946   struct owlfaim_priv *priv = (struct owlfaim_priv *)sess->aux_data;
     946  struct owlfaim_priv *priv = sess->aux_data;
    947947  FILE *f;
    948948  static const char defaultmod[] = "aim.exe";
     
    10691069static int faimtest_memrequest(aim_session_t *sess, aim_frame_t *fr, ...)
    10701070{
    1071   struct owlfaim_priv *priv = (struct owlfaim_priv *)sess->aux_data;
     1071  struct owlfaim_priv *priv = sess->aux_data;
    10721072  va_list ap;
    10731073  fu32_t offset, len;
     
    11681168static int faimtest_parse_incoming_im_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args)
    11691169{
    1170   struct owlfaim_priv *priv = (struct owlfaim_priv *)sess->aux_data;
     1170  struct owlfaim_priv *priv = sess->aux_data;
    11711171  owl_message *m;
    11721172  char *stripmsg, *nz_screenname, *wrapmsg;
  • cmd.c

    rd43edd2 r4d86e06  
    3939
    4040owl_cmd *owl_cmddict_find(owl_cmddict *d, char *name) {
    41   return (owl_cmd*)owl_dict_find_element(d, name);
     41  return owl_dict_find_element(d, name);
    4242}
    4343
     
    5151  cmd = owl_malloc(sizeof(owl_cmd));
    5252  owl_cmd_create_alias(cmd, alias_from, alias_to);
    53   owl_dict_insert_element(cd, cmd->name, (void*)cmd, (void(*)(void*))owl_cmd_free);   
     53  owl_dict_insert_element(cd, cmd->name, cmd, (void(*)(void*))owl_cmd_free);   
    5454  return(0);
    5555}
     
    6262  }
    6363  owl_perlconfig_new_command(cmd->name);
    64   return owl_dict_insert_element(cd, newcmd->name, (void*)newcmd, (void(*)(void*))owl_cmd_free);
     64  return owl_dict_insert_element(cd, newcmd->name, newcmd, (void(*)(void*))owl_cmd_free);
    6565}
    6666
     
    7070
    7171  if (!strcmp(argv[0], "")) {
    72   } else if (NULL != (cmd = (owl_cmd*)owl_dict_find_element(cd, argv[0]))) {
     72  } else if (NULL != (cmd = owl_dict_find_element(cd, argv[0]))) {
    7373    retval = owl_cmd_execute(cmd, cd, ctx, argc, argv, buff);
    7474  } else {
  • commands.c

    rd43edd2 r4d86e06  
    24392439      i--;      /* Accept 1-based indexing */
    24402440      if(i < owl_list_get_size(fl)) {
    2441         f = (owl_filter*)owl_list_get_element(fl, i);
     2441        f = owl_list_get_element(fl, i);
    24422442        owl_list_remove_element(fl, i);
    24432443        owl_filter_free(f);
  • context.c

    rd43edd2 r4d86e06  
    7070void owl_context_set_popless(owl_context *ctx, owl_viewwin *vw)
    7171{
    72   ctx->data = (void*)vw;
     72  ctx->data = vw;
    7373  SET_ACTIVE(ctx, OWL_CTX_POPLESS);
    7474}
     
    8181void owl_context_set_editmulti(owl_context *ctx, owl_editwin *ew)
    8282{
    83   ctx->data = (void*)ew;
     83  ctx->data = ew;
    8484  SET_ACTIVE(ctx, OWL_CTX_EDITMULTI);
    8585}
     
    8787void owl_context_set_editline(owl_context *ctx, owl_editwin *ew)
    8888{
    89   ctx->data = (void*)ew;
     89  ctx->data = ew;
    9090  SET_ACTIVE(ctx, OWL_CTX_EDITLINE);
    9191}
     
    9393void owl_context_set_editresponse(owl_context *ctx, owl_editwin *ew)
    9494{
    95   ctx->data = (void*)ew;
     95  ctx->data = ew;
    9696  SET_ACTIVE(ctx, OWL_CTX_EDITRESPONSE);
    9797}
  • dict.c

    rd43edd2 r4d86e06  
    1818int owl_dict_create(owl_dict *d) {
    1919  d->size=0;
    20   d->els=(owl_dict_el *)owl_malloc(INITSIZE*sizeof(owl_dict_el));
     20  d->els=owl_malloc(INITSIZE*sizeof(owl_dict_el));
    2121  d->avail=INITSIZE;
    2222  if (d->els==NULL) return(-1);
     
    6161  for (i=0; i<d->size; i++) {
    6262    if ((dupk = owl_strdup(d->els[i].k)) == NULL) return(-1);
    63     owl_list_append_element(l, (void*)dupk);
     63    owl_list_append_element(l, dupk);
    6464  }
    6565  return(0);
     
    9595    if (pos!=d->size) {
    9696      /* shift forward to leave us a slot */
    97       memmove((void*)(d->els+pos+1), (void*)(d->els+pos),
     97      memmove(d->els+pos+1, d->els+pos,
    9898              sizeof(owl_dict_el)*(d->size-pos));
    9999    }
     
    152152  printf("# BEGIN testing owl_dict\n");
    153153  FAIL_UNLESS("create", 0==owl_dict_create(&d));
    154   FAIL_UNLESS("insert b", 0==owl_dict_insert_element(&d, "b", (void*)bv, owl_dict_noop_free));
    155   FAIL_UNLESS("insert d", 0==owl_dict_insert_element(&d, "d", (void*)dv, owl_dict_noop_free));
    156   FAIL_UNLESS("insert a", 0==owl_dict_insert_element(&d, "a", (void*)av, owl_dict_noop_free));
    157   FAIL_UNLESS("insert c", 0==owl_dict_insert_element(&d, "c", (void*)cv, owl_dict_noop_free));
    158   FAIL_UNLESS("reinsert d (no replace)", -2==owl_dict_insert_element(&d, "d", (void*)dv, 0));
    159   FAIL_UNLESS("find a", (void*)av==owl_dict_find_element(&d, "a"));
    160   FAIL_UNLESS("find b", (void*)bv==owl_dict_find_element(&d, "b"));
    161   FAIL_UNLESS("find c", (void*)cv==owl_dict_find_element(&d, "c"));
    162   FAIL_UNLESS("find d", (void*)dv==owl_dict_find_element(&d, "d"));
     154  FAIL_UNLESS("insert b", 0==owl_dict_insert_element(&d, "b", bv, owl_dict_noop_free));
     155  FAIL_UNLESS("insert d", 0==owl_dict_insert_element(&d, "d", dv, owl_dict_noop_free));
     156  FAIL_UNLESS("insert a", 0==owl_dict_insert_element(&d, "a", av, owl_dict_noop_free));
     157  FAIL_UNLESS("insert c", 0==owl_dict_insert_element(&d, "c", cv, owl_dict_noop_free));
     158  FAIL_UNLESS("reinsert d (no replace)", -2==owl_dict_insert_element(&d, "d", dv, 0));
     159  FAIL_UNLESS("find a", av==owl_dict_find_element(&d, "a"));
     160  FAIL_UNLESS("find b", bv==owl_dict_find_element(&d, "b"));
     161  FAIL_UNLESS("find c", cv==owl_dict_find_element(&d, "c"));
     162  FAIL_UNLESS("find d", dv==owl_dict_find_element(&d, "d"));
    163163  FAIL_UNLESS("find e (non-existent)", NULL==owl_dict_find_element(&d, "e"));
    164   FAIL_UNLESS("remove d", (void*)dv==owl_dict_remove_element(&d, "d"));
     164  FAIL_UNLESS("remove d", dv==owl_dict_remove_element(&d, "d"));
    165165  FAIL_UNLESS("find d (post-removal)", NULL==owl_dict_find_element(&d, "d"));
    166166
  • fmtext.c

    rd43edd2 r4d86e06  
    785785  size = owl_list_get_size(l);
    786786  for (i=0; i<size; i++) {
    787     elem = (char*)owl_list_get_element(l,i);
     787    elem = owl_list_get_element(l,i);
    788788    if (elem && format_fn) {
    789789      text = format_fn(elem);
  • keymap.c

    rd43edd2 r4d86e06  
    4444   */
    4545  for (i = owl_list_get_size(&km->bindings)-1; i>=0; i--) {
    46     curkb = (owl_keybinding*)owl_list_get_element(&km->bindings, i);
     46    curkb = owl_list_get_element(&km->bindings, i);
    4747    if (owl_keybinding_equal(curkb, kb)) {
    4848      owl_list_remove_element(&km->bindings, i);
     
    152152{
    153153  owl_keymap *km;
    154   km = (owl_keymap*)owl_malloc(sizeof(owl_keymap));
     154  km = owl_malloc(sizeof(owl_keymap));
    155155  if (!km) return NULL;
    156156  owl_keymap_init(km, name, desc, default_fn, prealways_fn, postalways_fn);
     
    169169owl_keymap *owl_keyhandler_get_keymap(owl_keyhandler *kh, char *mapname)
    170170{
    171   return (owl_keymap*)owl_dict_find_element(&kh->keymaps, mapname);
     171  return owl_dict_find_element(&kh->keymaps, mapname);
    172172}
    173173
     
    191191  owl_keymap *km;
    192192  if (kh->active && !strcmp(mapname, kh->active->name)) return(kh->active);
    193   km = (owl_keymap*)owl_dict_find_element(&kh->keymaps, mapname);
     193  km = owl_dict_find_element(&kh->keymaps, mapname);
    194194  if (!km) return(NULL);
    195195  owl_keyhandler_reset(kh);
     
    240240  for (km=kh->active; km; km=km->submap) {
    241241    for (i=owl_list_get_size(&km->bindings)-1; i>=0; i--) {
    242       kb = (owl_keybinding*)owl_list_get_element(&km->bindings, i);
     242      kb = owl_list_get_element(&km->bindings, i);
    243243      match = owl_keybinding_match(kb, kh);
    244244      if (match == 1) {         /* subset match */
  • list.c

    rd43edd2 r4d86e06  
    88{
    99  l->size=0;
    10   l->list=(void **)owl_malloc(INITSIZE*sizeof(void *));
     10  l->list=owl_malloc(INITSIZE*sizeof(void *));
    1111  l->avail=INITSIZE;
    1212  if (l->list==NULL) return(-1);
  • message.c

    rd43edd2 r4d86e06  
    808808  /* save the hostname */
    809809  owl_function_debugmsg("About to do gethostbyaddr");
    810   hent=gethostbyaddr((char *) &(n->z_uid.zuid_addr), sizeof(n->z_uid.zuid_addr), AF_INET);
     810  hent=gethostbyaddr(&(n->z_uid.zuid_addr), sizeof(n->z_uid.zuid_addr), AF_INET);
    811811  if (hent && hent->h_name) {
    812812    owl_message_set_hostname(m, hent->h_name);
  • obarray.c

    raf1920fd r4d86e06  
    2525  while(first <= last) {
    2626    mid = first + (last - first)/2;
    27     str = (char*)owl_list_get_element(&(oa->strings), mid);
     27    str = owl_list_get_element(&(oa->strings), mid);
    2828    cmp = strcmp(key, str);
    2929    if(cmp == 0) {
  • owl.c

    r0bf6757 r4d86e06  
    693693
    694694  if (rfd<0) return;
    695   if (-1 == ioctl(rfd, FIONREAD, (void*)&navail)) {
     695  if (-1 == ioctl(rfd, FIONREAD, &navail)) {
    696696    return;
    697697  }
  • perlconfig.c

    rd43edd2 r4d86e06  
    307307  PERL_SYS_INIT3(Pargc, Pargv, Penv);
    308308  p=perl_alloc();
    309   owl_global_set_perlinterp(&g, (void*)p);
     309  owl_global_set_perlinterp(&g, p);
    310310  perl_construct(p);
    311311
     
    497497void owl_perlconfig_dispatch_free(owl_dispatch *d)
    498498{
    499   SvREFCNT_dec((SV*)d->data);
     499  SvREFCNT_dec(d->data);
    500500  owl_free(d);
    501501}
     
    503503void owl_perlconfig_edit_callback(owl_editwin *e)
    504504{
    505   SV *cb = (SV*)owl_editwin_get_cbdata(e);
     505  SV *cb = owl_editwin_get_cbdata(e);
    506506  SV *text;
    507507  dSP;
  • popexec.c

    rd43edd2 r4d86e06  
    108108  }
    109109
    110   if (0 != (rv_navail = ioctl(d->fd, FIONREAD, (void*)&navail))) {
     110  if (0 != (rv_navail = ioctl(d->fd, FIONREAD, &navail))) {
    111111    owl_function_debugmsg("ioctl error");
    112112  }
     
    160160void owl_popexec_viewwin_onclose(owl_viewwin *vwin, void *data)
    161161{
    162   owl_popexec *pe = (owl_popexec*)data;
     162  owl_popexec *pe = data;
    163163  int status, rv;
    164164
  • select.c

    rd43edd2 r4d86e06  
    9090  len = owl_list_get_size(dl);
    9191  for(i = 0; i < len; i++) {
    92     d = (owl_dispatch*)owl_list_get_element(dl, i);
     92    d = owl_list_get_element(dl, i);
    9393    if (d->fd == fd) return i;
    9494  }
     
    102102
    103103  dl = owl_global_get_dispatchlist(&g);
    104   d = (owl_dispatch*)owl_list_get_element(dl, elt);
     104  d = owl_list_get_element(dl, elt);
    105105  owl_list_remove_element(dl, elt);
    106106  if (d->destroy) {
     
    122122  if (elt != -1) {  /* If we have a dispatch for this FD */
    123123    owl_dispatch *d_old;
    124     d_old = (owl_dispatch*)owl_list_get_element(dl, elt);
     124    d_old = owl_list_get_element(dl, elt);
    125125    /* Ignore if we're adding the same dispatch again.  Otherwise
    126126       replace the old dispatch. */
     
    145145    /* Defer the removal until dispatch is done walking the list */
    146146    dl = owl_global_get_dispatchlist(&g);
    147     d = (owl_dispatch*)owl_list_get_element(dl, elt);
     147    d = owl_list_get_element(dl, elt);
    148148    d->needs_gc = 1;
    149149  } else {
     
    163163  elt = owl_select_find_dispatch(fd);
    164164  if (elt != -1) {
    165     d = (owl_dispatch*)owl_list_get_element(owl_global_get_dispatchlist(&g), elt);
     165    d = owl_list_get_element(owl_global_get_dispatchlist(&g), elt);
    166166    if (d->cfunc != owl_perlconfig_dispatch) {
    167167      /* don't mess with non-perl dispatch functions from here. */
     
    186186  elt = owl_select_find_dispatch(fd);
    187187  if (elt != -1) {
    188     d = (owl_dispatch*)owl_list_get_element(owl_global_get_dispatchlist(&g), elt);
     188    d = owl_list_get_element(owl_global_get_dispatchlist(&g), elt);
    189189    if (d->cfunc == owl_perlconfig_dispatch) {
    190190      owl_select_remove_dispatch_at(elt);
     
    207207  len = owl_select_dispatch_count(g);
    208208  for(i = 0; i < len; i++) {
    209     d = (owl_dispatch*)owl_list_get_element(dl, i);
     209    d = owl_list_get_element(dl, i);
    210210    FD_SET(d->fd, r);
    211211    FD_SET(d->fd, e);
     
    245245
    246246  for(i = 0; i < len; i++) {
    247     d = (owl_dispatch*)owl_list_get_element(dl, i);
     247    d = owl_list_get_element(dl, i);
    248248    /* While d shouldn't normally be null, the list may be altered by
    249249     * functions we dispatch to. */
  • util.c

    rd43edd2 r4d86e06  
    139139    if (first) {
    140140      first=0;
    141       foo=(char *)strtok(workbuff, sep);
     141      foo=strtok(workbuff, sep);
    142142    } else {
    143       foo=(char *)strtok(NULL, sep);
     143      foo=strtok(NULL, sep);
    144144    }
    145145    if (foo==NULL) {
    146146      done=1;
    147147    } else {
    148       args=(char **)owl_realloc(args, sizeof(char *) * (count+1));
     148      args=owl_realloc(args, sizeof(char *) * (count+1));
    149149      args[count]=owl_malloc(strlen(foo)+1);
    150150      strcpy(args[count], foo);
  • variable.c

    rd43edd2 r4d86e06  
    521521      return(-2);
    522522    }
    523     owl_dict_insert_element(vd, cur->name, (void*)cur, NULL);
     523    owl_dict_insert_element(vd, cur->name, cur, NULL);
    524524  }
    525525  return 0;
     
    528528void owl_variable_dict_add_variable(owl_vardict * vardict,
    529529                                    owl_variable * var) {
    530   owl_dict_insert_element(vardict, var->name, (void*)var, (void(*)(void*))owl_variable_free);
     530  owl_dict_insert_element(vardict, var->name, var, (void(*)(void*))owl_variable_free);
    531531}
    532532
    533533owl_variable * owl_variable_newvar(char *name, char *summary, char * description) {
    534   owl_variable * var = (owl_variable*)owl_malloc(sizeof(owl_variable));
     534  owl_variable * var = owl_malloc(sizeof(owl_variable));
    535535  memset(var, 0, sizeof(owl_variable));
    536536  var->name = owl_strdup(name);
     
    739739/* returns a reference */
    740740char *owl_variable_get_string(owl_vardict *d, char *name) {
    741   return (char*)owl_variable_get(d,name, OWL_VARIABLE_STRING);
     741  return owl_variable_get(d,name, OWL_VARIABLE_STRING);
    742742}
    743743
    744744/* returns a reference */
    745745void *owl_variable_get_other(owl_vardict *d, char *name) {
    746   return (char*)owl_variable_get(d,name, OWL_VARIABLE_OTHER);
     746  return owl_variable_get(d,name, OWL_VARIABLE_OTHER);
    747747}
    748748
    749749int owl_variable_get_int(owl_vardict *d, char *name) {
    750750  int *pi;
    751   pi = (int*)owl_variable_get(d,name,OWL_VARIABLE_INT);
     751  pi = owl_variable_get(d,name,OWL_VARIABLE_INT);
    752752  if (!pi) return(-1);
    753753  return(*pi);
     
    756756int owl_variable_get_bool(owl_vardict *d, char *name) {
    757757  int *pi;
    758   pi = (int*)owl_variable_get(d,name,OWL_VARIABLE_BOOL);
     758  pi = owl_variable_get(d,name,OWL_VARIABLE_BOOL);
    759759  if (!pi) return(-1);
    760760  return(*pi);
  • view.c

    rd43edd2 r4d86e06  
    3838
    3939  /* nuke the old list */
    40   owl_list_free_simple((owl_list *) ml);
     40  owl_list_free_simple(&ml->list);
    4141  owl_messagelist_create(&(v->ml));
    4242
     
    161161void owl_view_free(owl_view *v)
    162162{
    163   owl_list_free_simple((owl_list *) &(v->ml));
     163  owl_list_free_simple(&v->ml.list);
    164164  if (v->name) owl_free(v->name);
    165165}
  • zcrypt.c

    rd43edd2 r4d86e06  
    249249      /* Prepare result to be returned */
    250250      char *temp = keyfile;
    251       keyfile = (char *)owl_malloc(strlen(temp) + 1);
     251      keyfile = owl_malloc(strlen(temp) + 1);
    252252      if (keyfile) {
    253253        strcpy(keyfile, temp);
  • zephyr.c

    rd43edd2 r4d86e06  
    4242  }
    4343
    44   (void) memset((char *)&sin, 0, sizeof(struct sockaddr_in));
     44  (void) memset(&sin, 0, sizeof(struct sockaddr_in));
    4545
    4646  sp = getservbyname(HM_SVCNAME, "udp");
     
    5151  sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
    5252
    53   (void) memset((char *)&req, 0, sizeof(req));
     53  (void) memset(&req, 0, sizeof(req));
    5454  req.z_kind = STAT;
    5555  req.z_port = 0;
     
    278278   
    279279    /* add it to the list of subs */
    280     if ((tmp=(char *) strtok(start, ",\n\r"))==NULL) continue;
     280    if ((tmp=strtok(start, ",\n\r"))==NULL) continue;
    281281    subs[count].zsub_class=owl_strdup(tmp);
    282     if ((tmp=(char *) strtok(NULL, ",\n\r"))==NULL) continue;
     282    if ((tmp=strtok(NULL, ",\n\r"))==NULL) continue;
    283283    subs[count].zsub_classinst=owl_strdup(tmp);
    284     if ((tmp=(char *) strtok(NULL, " \t\n\r"))==NULL) continue;
     284    if ((tmp=strtok(NULL, " \t\n\r"))==NULL) continue;
    285285    subs[count].zsub_recipient=owl_strdup(tmp);
    286286   
Note: See TracChangeset for help on using the changeset viewer.