Changeset 5682 for branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/EXTERNAL/AGRIF/LIB/WorkWithAllocatelist.c
- Timestamp:
- 2015-08-12T17:46:45+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/EXTERNAL/AGRIF/LIB/WorkWithAllocatelist.c
r2528 r5682 45 45 /* */ 46 46 /******************************************************************************/ 47 void Add_Allocate_Var_1(c har *nom,char *nommodule)47 void Add_Allocate_Var_1(const char *nom, const char *nommodule) 48 48 { 49 49 listallocate *newvar; … … 55 55 if ( !List_Allocate_Var ) 56 56 { 57 newvar = (listallocate *) malloc(sizeof(listallocate));57 newvar = (listallocate *)calloc(1,sizeof(listallocate)); 58 58 strcpy(newvar->a_nomvar,nom); 59 strcpy(newvar->a_subroutine,subroutinename); 60 strcpy(newvar->a_module,nommodule); 59 61 Save_Length(nom,25); 60 strcpy(newvar->a_subroutine,subroutinename);61 Save_Length(subroutinename,26);62 strcpy(newvar->a_module,nommodule);63 Save_Length(nommodule,27);64 62 newvar->suiv = NULL; 65 63 List_Allocate_Var = newvar; … … 71 69 while ( parcours->suiv && out == 0 ) 72 70 { 73 if ( !strcasecmp(parcours->a_nomvar, nom) &&74 !strcasecmp(parcours->a_subroutine, subroutinename) &&75 !strcasecmp(parcours->a_module, nommodule) ) out = 1;71 if ( !strcasecmp(parcours->a_nomvar, nom) && 72 !strcasecmp(parcours->a_subroutine, subroutinename) && 73 !strcasecmp(parcours->a_module, nommodule) ) out = 1; 76 74 else 77 75 parcours=parcours->suiv; … … 85 83 { 86 84 /* add the record */ 87 newvar = (listallocate *)malloc(sizeof(listallocate)); 88 strcpy(newvar->a_nomvar,nom); 85 newvar = (listallocate *)calloc(1,sizeof(listallocate)); 86 strcpy(newvar->a_nomvar, nom); 87 strcpy(newvar->a_subroutine, subroutinename); 88 strcpy(newvar->a_module, nommodule); 89 89 Save_Length(nom,25); 90 strcpy(newvar->a_subroutine,subroutinename);91 Save_Length(subroutinename,26);92 strcpy(newvar->a_module,nommodule);93 Save_Length(nommodule,27);94 90 newvar->suiv = NULL; 95 91 parcours->suiv = newvar; … … 108 104 /* */ 109 105 /******************************************************************************/ 110 int IsVarAllocatable_0(char *ident) 111 { 112 listallocate *parcours; 113 int out; 114 115 out = 0 ; 116 if ( firstpass == 0 ) 117 { 118 parcours = List_Allocate_Var; 119 while ( parcours && out == 0 ) 120 { 121 if ( !strcasecmp(parcours->a_nomvar,ident) ) out = 1 ; 122 else parcours=parcours->suiv; 123 } 124 } 125 return out; 126 } 127 128 129 /******************************************************************************/ 130 /* varisallocatable_0 */ 131 /******************************************************************************/ 132 /* Firstpass 0 */ 133 /******************************************************************************/ 134 /* */ 135 /******************************************************************************/ 136 int varisallocatable_0(char *ident) 137 { 138 listallocate *newvaralloc; 139 int out; 140 141 out =0; 142 if (firstpass == 0 ) 143 { 144 newvaralloc = List_Allocate_Var; 145 while ( newvaralloc && out == 0 ) 146 { 147 if ( !strcasecmp(ident,newvaralloc->a_nomvar) ) out = 1; 148 else newvaralloc = newvaralloc->suiv; 149 } 150 } 151 return out; 152 } 106 // int IsVarAllocatable_0(const char *ident) 107 // { 108 // listallocate *parcours; 109 // int out; 110 // 111 // out = 0 ; 112 // if ( firstpass == 0 ) 113 // { 114 // parcours = List_Allocate_Var; 115 // while ( parcours && out == 0 ) 116 // { 117 // if ( !strcasecmp(parcours->a_nomvar,ident) ) out = 1 ; 118 // else parcours=parcours->suiv; 119 // } 120 // } 121 // return out; 122 // }
Note: See TracChangeset
for help on using the changeset viewer.