Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • W weston
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 341
    • Issues 341
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 132
    • Merge requests 132
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • waylandwayland
  • weston
  • Issues
  • #353
Closed
Open
Issue created Jan 31, 2020 by Pekka Paalanen@pqMaintainer

Log subscriber API is not type-safe

We have weston_log_subscriber_create_log() and weston_log_subscriber_create_flight_rec() which both return the same type struct weston_log_subscriber *. However, the API requires that each is destroyed with the right function weston_log_subscriber_destroy_log() or weston_log_subscriber_destroy_flight_rec(). There is no type safety that would guarantee that someone calling the wrong destroy function would get a compiler warning.

Either the two create functions need to return distinct types and the two destroy functions need to take the same distinct types, or the create functions stay as is and the destroy functions are both folded into a single weston_log_subscriber_destroy(struct weston_log_subscriber *) function where it internally then diverges into the specialized cases.

Which way to go? If there is any public API that would apply only to one kind of subscriber, then we must choose distinct types. Otherwise, either solution will do with perhaps a slight preference towards a common destroy function to reduce API surface.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking