Difference for server/plugins.c from version 1.14 to 1.15


version 1.14 version 1.15
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_plugins_c =   * static char *rcsid_plugins_c =
  *   "$Id: plugins.c,v 1.14 2002/02/06 05:54:47 mwedel Exp $";   *   "$Id: plugins.c,v 1.15 2002/02/22 09:47:39 gros Exp $";
  */   */
   
 /*****************************************************************************/  /*****************************************************************************/
Line 60
 
Line 60
 /*****************************************************************************/  /*****************************************************************************/
 CommArray_s *find_plugin_command(char *cmd, object *op)  CommArray_s *find_plugin_command(char *cmd, object *op)
 {  {
     CFParm* CmdParm;      CFParm CmdParm;
     CFParm* RTNValue;      CFParm* RTNValue;
     int i;      int i;
     char cmdchar[10];      char cmdchar[10];
     CommArray_s *RTNCmd;      static CommArray_s RTNCmd;
   
     strcpy(cmdchar,"command?");      strcpy(cmdchar,"command?");
     /* Why do a malloc/free?  Would be a lot faster to just declare      CmdParm.Value[0] = cmdchar;
      * it as a non pointer.      CmdParm.Value[1] = cmd;
      */      CmdParm.Value[2] = op;
     CmdParm = (CFParm *)(malloc(sizeof(CFParm)));  
     CmdParm->Value[0] = cmdchar;  
     CmdParm->Value[1] = cmd;  
     CmdParm->Value[2] = op;  
   
     for(i=0;i<PlugNR;i++)      for(i=0;i<PlugNR;i++)
     {      {
         RTNValue = PlugList[i].propfunc(CmdParm);          RTNValue = (PlugList[i].propfunc(&CmdParm));
         if (RTNValue!=NULL)          if (RTNValue!=NULL)
         {          {
      RTNCmd = (CommArray_s *)(malloc(sizeof(CommArray_s)));              RTNCmd.name = (char *)(RTNValue->Value[0]);
             RTNCmd->name = (char *)(RTNValue->Value[0]);              RTNCmd.func = (CommFunc)(RTNValue->Value[1]);
             RTNCmd->func = (CommFunc)(RTNValue->Value[1]);              RTNCmd.time = *(float *)(RTNValue->Value[2]);
             RTNCmd->time = *(float *)(RTNValue->Value[2]);              printf("RTNCMD: name %s, time %d\n", RTNCmd.name, RTNCmd.time);
      /* Note that this is a memory leak here also, because the              return &RTNCmd;
       * caller doesn't free this data.  Probably better to  
       * make RTNCmd a static - that will work unless this function  
       * needs to be recursive or crossfire becomes threaded  
       */  
      free(CmdParm);  
             return RTNCmd;  
         };          };
     };      };
     free(CmdParm);  
     return NULL;      return NULL;
 };  };
   


Legend:
line(s) removed in v.1.14 
line(s) changed
 line(s) added in v.1.15

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:43