Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit74b41f5

Browse files
Make some use of anonymous unions [DSM registry].
Make some use of anonymous unions, which are allowed as of C11, asexamples and encouragement for future code, and to test compilers.This commit changes the DSMRegistryEntry struct.Reviewed-by: Peter Eisentraut <peter@eisentraut.org>Discussion:https://postgr.es/m/aNKsDg0fJwqhZdXX%40nathan
1 parenta69b55c commit74b41f5

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

‎src/backend/storage/ipc/dsm_registry.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ typedef struct DSMRegistryEntry
9898
NamedDSMStatedsm;
9999
NamedDSAStatedsa;
100100
NamedDSHStatedsh;
101-
}data;
101+
};
102102
}DSMRegistryEntry;
103103

104104
staticconstdshash_parametersdsh_params= {
@@ -212,7 +212,7 @@ GetNamedDSMSegment(const char *name, size_t size,
212212
entry=dshash_find_or_insert(dsm_registry_table,name,found);
213213
if (!(*found))
214214
{
215-
NamedDSMState*state=&entry->data.dsm;
215+
NamedDSMState*state=&entry->dsm;
216216
dsm_segment*seg;
217217

218218
entry->type=DSMR_ENTRY_TYPE_DSM;
@@ -232,12 +232,12 @@ GetNamedDSMSegment(const char *name, size_t size,
232232
elseif (entry->type!=DSMR_ENTRY_TYPE_DSM)
233233
ereport(ERROR,
234234
(errmsg("requested DSM segment does not match type of existing entry")));
235-
elseif (entry->data.dsm.size!=size)
235+
elseif (entry->dsm.size!=size)
236236
ereport(ERROR,
237237
(errmsg("requested DSM segment size does not match size of existing segment")));
238238
else
239239
{
240-
NamedDSMState*state=&entry->data.dsm;
240+
NamedDSMState*state=&entry->dsm;
241241
dsm_segment*seg;
242242

243243
/* If the existing segment is not already attached, attach it now. */
@@ -294,7 +294,7 @@ GetNamedDSA(const char *name, bool *found)
294294
entry=dshash_find_or_insert(dsm_registry_table,name,found);
295295
if (!(*found))
296296
{
297-
NamedDSAState*state=&entry->data.dsa;
297+
NamedDSAState*state=&entry->dsa;
298298

299299
entry->type=DSMR_ENTRY_TYPE_DSA;
300300

@@ -314,7 +314,7 @@ GetNamedDSA(const char *name, bool *found)
314314
(errmsg("requested DSA does not match type of existing entry")));
315315
else
316316
{
317-
NamedDSAState*state=&entry->data.dsa;
317+
NamedDSAState*state=&entry->dsa;
318318

319319
if (dsa_is_attached(state->handle))
320320
ereport(ERROR,
@@ -367,7 +367,7 @@ GetNamedDSHash(const char *name, const dshash_parameters *params, bool *found)
367367
entry=dshash_find_or_insert(dsm_registry_table,name,found);
368368
if (!(*found))
369369
{
370-
NamedDSHState*dsh_state=&entry->data.dsh;
370+
NamedDSHState*dsh_state=&entry->dsh;
371371
dshash_parametersparams_copy;
372372
dsa_area*dsa;
373373

@@ -395,7 +395,7 @@ GetNamedDSHash(const char *name, const dshash_parameters *params, bool *found)
395395
(errmsg("requested DSHash does not match type of existing entry")));
396396
else
397397
{
398-
NamedDSHState*dsh_state=&entry->data.dsh;
398+
NamedDSHState*dsh_state=&entry->dsh;
399399
dsa_area*dsa;
400400

401401
/* XXX: Should we verify params matches what table was created with? */
@@ -447,7 +447,7 @@ pg_get_dsm_registry_allocations(PG_FUNCTION_ARGS)
447447
* attaching to them, return NULL for those.
448448
*/
449449
if (entry->type==DSMR_ENTRY_TYPE_DSM)
450-
vals[2]=Int64GetDatum(entry->data.dsm.size);
450+
vals[2]=Int64GetDatum(entry->dsm.size);
451451
else
452452
nulls[2]= true;
453453

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp