Changeset defe4a3


Ignore:
Timestamp:
Aug 15, 2009, 7:08:17 PM (8 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:
712caac
Parents:
7565f8f
git-author:
Anders Kaseorg <andersk@mit.edu> (08/04/09 01:20:29)
git-committer:
Anders Kaseorg <andersk@mit.edu> (08/15/09 19:08:17)
Message:
Add const qualifiers for int *.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • variable.c

    rc1d9441 rdefe4a3  
    378378{
    379379  if (newval == NULL) return(0);
    380   else if (*(int*)newval < 1) return(0);
     380  else if (*(const int*)newval < 1) return(0);
    381381  else return (1);
    382382}
     
    385385{
    386386  if (newval == NULL) return(0);
    387   else if (*(int*)newval < 0) return(0);
     387  else if (*(const int*)newval < 0) return(0);
    388388  else return (1);
    389389}
     
    401401int owl_variable_debug_set(owl_variable *v, void *newval)
    402402{
    403   if (newval && (*(int*)newval == 1 || *(int*)newval == 0)) {
    404     g.debug = *(int*)newval;
     403  if (newval && (*(const int*)newval == 1 || *(const int*)newval == 0)) {
     404    g.debug = *(const int*)newval;
    405405  }
    406406  return owl_variable_bool_set_default(v, newval);
     
    411411{
    412412  if (newval) {
    413     if (*(int*)newval == 1) {
     413    if (*(const int*)newval == 1) {
    414414      owl_aim_set_awaymsg(owl_global_get_aaway_msg(&g));
    415     } else if (*(int*)newval == 0) {
     415    } else if (*(const int*)newval == 0) {
    416416      owl_aim_set_awaymsg("");
    417417    }
     
    423423{
    424424  if (newval) {
    425     if (*(int*)newval == 1) {
     425    if (*(const int*)newval == 1) {
    426426      owl_function_zephyr_buddy_check(0);
    427427    }
     
    438438
    439439  if (newval && !owl_context_is_startup(owl_global_get_context(&g))) {
    440     if (*(int*)newval == 2) {
     440    if (*(const int*)newval == 2) {
    441441      owl_function_command_norv("bindkey editmulti C-d command edit:delete-next-char");
    442     } else if (*(int*)newval == 1) {
     442    } else if (*(const int*)newval == 1) {
    443443      owl_function_command_norv("bindkey editmulti C-d command editmulti:done-or-delete");
    444444    } else {
     
    748748
    749749int owl_variable_get_int(owl_vardict *d, char *name) {
    750   int *pi;
     750  const int *pi;
    751751  pi = owl_variable_get(d,name,OWL_VARIABLE_INT);
    752752  if (!pi) return(-1);
     
    755755
    756756int owl_variable_get_bool(owl_vardict *d, char *name) {
    757   int *pi;
     757  const int *pi;
    758758  pi = owl_variable_get(d,name,OWL_VARIABLE_BOOL);
    759759  if (!pi) return(-1);
     
    851851int owl_variable_bool_validate_default(owl_variable *v, void *newval) {
    852852  if (newval == NULL) return(0);
    853   else if (*(int*)newval==1 || *(int*)newval==0) return(1);
     853  else if (*(const int*)newval==1 || *(const int*)newval==0) return(1);
    854854  else return (0);
    855855}
     
    859859    if (!v->validate_fn(v, newval)) return(-1);
    860860  }
    861   *(int*)v->val = *(int*)newval;
     861  *(int*)v->val = *(const int*)newval;
    862862  return(0);
    863863}
     
    875875    snprintf(buf, bufsize, "<null>");
    876876    return -1;
    877   } else if (*(int*)val == 0) {
     877  } else if (*(const int*)val == 0) {
    878878    snprintf(buf, bufsize, "off");
    879879    return 0;
    880   } else if (*(int*)val == 1) {
     880  } else if (*(const int*)val == 1) {
    881881    snprintf(buf, bufsize, "on");
    882882    return 0;
     
    898898    if (!v->validate_fn(v, newval)) return(-1);
    899899  }
    900   *(int*)v->val = *(int*)newval;
     900  *(int*)v->val = *(const int*)newval;
    901901  return(0);
    902902}
     
    915915    return -1;
    916916  } else {
    917     snprintf(buf, bufsize, "%d", *(int*)val);
     917    snprintf(buf, bufsize, "%d", *(const int*)val);
    918918    return 0;
    919919  }
     
    929929  if (enums == NULL) return(0);
    930930  atokenize_free(enums, nenums);
    931   val = *(int*)newval;
     931  val = *(const int*)newval;
    932932  if (val < 0 || val >= nenums) {
    933933    return(0);
     
    961961  }
    962962  enums = atokenize(v->validsettings, ",", &nenums);
    963   i = *(int*)val;
     963  i = *(const int*)val;
    964964  if (i<0 || i>=nenums) {
    965965    snprintf(buf, bufsize, "<invalid:%d>",i);
Note: See TracChangeset for help on using the changeset viewer.