Changeset 8dfb59c


Ignore:
Timestamp:
Mar 23, 2010, 5:23:43 PM (14 years ago)
Author:
Nelson Elhage <nelhage@ksplice.com>
Branches:
master, release-1.10, release-1.6, release-1.7, release-1.8, release-1.9
Children:
38cc669
Parents:
1b1cd2c
git-author:
Nelson Elhage <nelhage@mit.edu> (03/04/10 09:41:04)
git-committer:
Nelson Elhage <nelhage@ksplice.com> (03/23/10 17:23:43)
Message:
Nuke the editwin buffercommand.

This was really just an alternate name for callback data that was
known to be a string. Now that we can safely pass callback data that
needs to be destroyed, it's redundant.
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r8a921b5 r8dfb59c  
    25662566  /* if we get two arguments, ask for the password */
    25672567  if (argc==2) {
    2568     owl_global_set_buffercommand(&g, argv[1]);
    2569     owl_global_set_buffercallback(&g, &owl_callback_aimlogin);
     2568    owl_editwin_set_cbdata(owl_global_get_typwin(&g),
     2569                           owl_strdup(argv[1]), owl_free);
     2570    owl_editwin_set_callback(owl_global_get_typwin(&g),
     2571                             owl_callback_aimlogin);
    25702572    owl_function_start_password("AIM Password: ");
    25712573    return(NULL);
  • editwin.c

    r1b1cd2c r8dfb59c  
    3535  oe_excursion *excursions;
    3636
    37   char *command;
    3837  void (*callback)(struct _owl_editwin*);
    3938  void (*destroy_cbdata)(void *);
     
    7776  owl_free(e->buff);
    7877  owl_free(e->killbuf);
    79   owl_free(e->command);
    8078  /* just in case someone forgot to clean up */
    8179  while (e->excursions) {
     
    181179{
    182180  e->dotsend=1;
    183 }
    184 
    185 void owl_editwin_set_command(owl_editwin *e, const char *command)
    186 {
    187   if(e->command) owl_free(e->command);
    188   e->command = owl_strdup(command);
    189 }
    190 
    191 const char *owl_editwin_get_command(owl_editwin *e)
    192 {
    193   if(e->command) return e->command;
    194   return "";
    195181}
    196182
  • functions.c

    r1b1cd2c r8dfb59c  
    296296
    297297  owl_editwin_set_cbdata(owl_global_get_typwin(&g), data, cleanup);
    298   owl_global_set_buffercallback(&g, callback);
     298  owl_editwin_set_callback(owl_global_get_typwin(&g), callback);
    299299  owl_global_push_context(&g, OWL_CTX_EDITMULTI, e, "editmulti");
    300300}
     
    312312                         noun);
    313313
    314   owl_function_start_edit_win(line, callback, NULL, NULL);
    315   owl_global_set_buffercommand(&g, line);
     314  owl_function_start_edit_win(line, callback,
     315                              owl_strdup(line),
     316                              owl_free);
    316317}
    317318
     
    349350
    350351void owl_callback_zwrite(owl_editwin *e) {
    351   owl_function_zwrite(owl_editwin_get_command(e),
     352  char *command = owl_editwin_get_cbdata(e);
     353  owl_function_zwrite(command,
    352354                      owl_editwin_get_text(e));
    353355}
     
    447449
    448450void owl_callback_aimwrite(owl_editwin *e) {
    449   owl_function_aimwrite(owl_editwin_get_command(e),
     451  char *command = owl_editwin_get_cbdata(e);
     452  owl_function_aimwrite(command,
    450453                        owl_editwin_get_text(e));
    451454}
     
    882885
    883886void owl_callback_aimlogin(owl_editwin *e) {
    884   owl_function_aimlogin(owl_editwin_get_command(e),
     887  char *user = owl_editwin_get_cbdata(e);
     888  owl_function_aimlogin(user,
    885889                        owl_editwin_get_text(e));
    886890}
  • global.c

    r2ee9e8d r8dfb59c  
    324324}
    325325
    326 /* buffercommand */
    327 
    328 void owl_global_set_buffercommand(owl_global *g, const char *command) {
    329   owl_editwin_set_command(owl_global_get_typwin(g), command);
    330 }
    331 
    332 const char *owl_global_get_buffercommand(const owl_global *g) {
    333   return owl_editwin_get_command(owl_global_get_typwin(g));
    334 }
    335 
    336 void owl_global_set_buffercallback(owl_global *g, void (*cb)(owl_editwin*)) {
    337   owl_editwin_set_callback(owl_global_get_typwin(g), cb);
    338 }
    339 
    340 void (*owl_global_get_buffercallback(const owl_global *g))(owl_editwin*) {
    341   return owl_editwin_get_callback(owl_global_get_typwin(g));
    342 }
    343 
    344326/* refresh */
    345327
Note: See TracChangeset for help on using the changeset viewer.