View Issue Details

IDProjectCategoryView StatusLast Update
0006743GNUnetfile-sharing servicepublic2021-04-05 11:25
Reportercy1 Assigned Toschanzen  
PrioritylowSeverityfeatureReproducibilityhave not tried
Status feedbackResolutionopen 
PlatformGentooOSLinuxOS Version5.9.1
Product VersionGit master 
Target Version0.14.2 
Summary0006743: anonymous structs in GNUNET_FS_ProgressInfo impede modularity
DescriptionI'd like to write myself a dispatcher that delegates to various dispatchers in different modules for each operation, like:

```
static void* progress_cb (void *cls,
                          const struct GNUNET_FS_ProgressInfo *info) {
    switch(info->status) {
    case GNUNET_FS_STATUS_SEARCH_RESULT:
              return search_progress(info->value.search);
        case GNUNET_FS_DOWNLOAD_PROGRESS:
              return download_progress(info->value.download);
        ...
        };
}
```

But since info->value.search is an anonymous struct, there is no way to write the function signature for search_progress, or download_progress, outside of using typeof like:

```
const struct GNUNET_FS_ProgressInfo dummyvariable __attribute__((__unused__));
void* search_progress(const typeof(dummyvariable.value.search) info);
```

I would appreciate it if each of the members of that union could be given names, however ludicrously verbose, so that I could write:

```
void* search_progress(GNUNET_FS_ProgressInfoSearch info);
```

Once I know it's a search event, there's no reason to access value.download or value.publish, so it just prevents me from removing verbosity, and introduces potential for interface boundary failures such as accidentally using code which accesses value.download in a search dispatcher. Anyway it's just a little nitpick I wanted to get reported so that someone with commit access could patch it whenever they get around to it.
TagsNo tags attached.

Activities

cy1

2021-02-06 18:11

reporter  

schanzen

2021-02-21 10:55

manager   ~0017558

Can you check 8095b1a1b..a3971a93c if that is what you need?

Issue History

Date Modified Username Field Change
2021-02-06 18:11 cy1 New Issue
2021-02-06 18:11 cy1 File Added: named_progress_values.bundle
2021-02-21 10:55 schanzen Assigned To => schanzen
2021-02-21 10:55 schanzen Status new => feedback
2021-02-21 10:55 schanzen Note Added: 0017558
2021-02-21 10:55 schanzen Target Version => 0.14.1
2021-04-05 11:25 schanzen Target Version 0.14.1 => 0.14.2