[torqueusers] Size difference between pbsndlist and pbsndmast

Prakash Velayutham velayups at email.uc.edu
Fri Jul 22 07:27:47 MDT 2005


Hi,

Should the pbsndlist and pbsndmast arrays (of ptr) have the same size?

I see in one place where there is a realloc of pbsndmast to svr_totnodes 
+ 1. After this svr_totnodes++ is done. And a realloc of pbsndlist to 
svr_totnodes + 1 (with already increased svr_totnodes variable). Is this 
how it is supposed to be? All of these inside the "create_pbs_node" 
function  in the src/server/node_func.c file.

Here is the code snippet:

..
tmpndlist = (struct pbsnode **)realloc(
     pbsndmast,
     sizeof(struct pbsnode*) * (svr_totnodes + 1));

   if (tmpndlist == (struct pbsnode **)0)
     {
     free(pnode);
     free(pul);
     free(pname);

     return(PBSE_SYSTEM);
     }

   /*add in the new entry etc*/

   pbsndmast = tmpndlist;
   pbsndmast[svr_totnodes++] = pnode;

   tmpndlist = (struct pbsnode **)realloc(
     pbsndlist,
     sizeof(struct pbsnode *) * (svr_totnodes + 1));
..

Thanks,
Prakash


More information about the torqueusers mailing list