@@ -166,7 +166,7 @@ _PG_fini(void)
166166static void
167167ispell_shmem_startup ()
168168{
169- bool found = FALSE ;
169+ bool found = false ;
170170 char * segment ;
171171
172172 if (prev_shmem_startup_hook )
@@ -177,27 +177,19 @@ ispell_shmem_startup()
177177 */
178178 LWLockAcquire (AddinShmemInitLock , LW_EXCLUSIVE );
179179
180- segment = ShmemInitStruct (SEGMENT_NAME ,
181- max_ispell_mem_size (),
182- & found );
180+ segment = ShmemInitStruct (SEGMENT_NAME , max_ispell_mem_size (), & found );
183181 segment_info = (SegmentInfo * ) segment ;
184182
185183 /* Was the shared memory segment already initialized? */
186184 if (!found )
187185 {
188- if (segment == NULL ) {
189- ereport (ERROR ,
190- (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
191- errmsg ("Cannot acquire %d kB of shared memory" ,
192- max_ispell_mem_size_kb )));
193- }
194186 memset (segment , 0 , max_ispell_mem_size ());
195187
196- #if PG_VERSION_NUM >= 90600
188+ #if PG_VERSION_NUM >= 90600
197189 segment_info -> lock = & (GetNamedLWLockTranche ("shared_ispell" ))-> lock ;
198- #else
190+ #else
199191 segment_info -> lock = LWLockAssign ();
200- #endif
192+ #endif
201193 segment_info -> firstfree = segment + MAXALIGN (sizeof (SegmentInfo ));
202194 segment_info -> available = max_ispell_mem_size ()
203195 - (int )(segment_info -> firstfree - segment );
@@ -293,9 +285,9 @@ clean_dict_affix(IspellDict *dict)
293285static void
294286init_shared_dict (DictInfo * info , char * dictFile , char * affFile , char * stopFile )
295287{
296- int size ;
288+ int size ;
297289 SharedIspellDict * shdict = NULL ;
298- SharedStopList * shstop = NULL ;
290+ SharedStopList * shstop = NULL ;
299291
300292 /* DICTIONARY + AFFIXES */
301293
@@ -315,7 +307,7 @@ init_shared_dict(DictInfo *info, char *dictFile, char *affFile, char *stopFile)
315307 /* load the dictionary (word list) if not yet defined */
316308 if (shdict == NULL )
317309 {
318- IspellDict * dict ;
310+ IspellDict * dict ;
319311
320312 dict = (IspellDict * ) palloc0 (sizeof (IspellDict ));
321313
@@ -337,11 +329,13 @@ init_shared_dict(DictInfo *info, char *dictFile, char *affFile, char *stopFile)
337329 */
338330 if (info -> dict .useFlagAliases )
339331 {
340- int i ;
332+ int i ;
333+
341334 dict -> useFlagAliases = true;
342335 dict -> lenAffixData = info -> dict .lenAffixData ;
343336 dict -> nAffixData = info -> dict .nAffixData ;
344337 dict -> AffixData = (char * * ) palloc0 (dict -> nAffixData * sizeof (char * ));
338+
345339 for (i = 0 ; i < dict -> nAffixData ; i ++ )
346340 {
347341 dict -> AffixData [i ] = palloc0 (strlen (info -> dict .AffixData [i ]) + 1 );
@@ -721,8 +715,8 @@ shstrcpy(char *str)
721715static SPNode *
722716copySPNode (SPNode * node )
723717{
724- int i ;
725- SPNode * copy = NULL ;
718+ int i ;
719+ SPNode * copy = NULL ;
726720
727721 if (node == NULL )
728722 return NULL ;
@@ -739,8 +733,8 @@ copySPNode(SPNode *node)
739733static int
740734sizeSPNode (SPNode * node )
741735{
742- int i ;
743- int size = 0 ;
736+ int i ;
737+ int size = 0 ;
744738
745739 if (node == NULL )
746740 return 0 ;
@@ -852,9 +846,9 @@ sizeIspellDict(IspellDict *dict, char *dictFile, char *affixFile)
852846Datum
853847dispell_list_dicts (PG_FUNCTION_ARGS )
854848{
855- FuncCallContext * funcctx ;
856- TupleDesc tupdesc ;
857- SharedIspellDict * dict ;
849+ FuncCallContext * funcctx ;
850+ TupleDesc tupdesc ;
851+ SharedIspellDict * dict ;
858852
859853 /* init on the first call */
860854 if (SRF_IS_FIRSTCALL ())
0 commit comments