Skip to content

use std::format* instead of snprintf in xwayland_spawner.cpp#4793

Open
yotam-medini wants to merge 2 commits intocanonical:mainfrom
yotam-medini:stdfmt-4660-xwayland_spawner
Open

use std::format* instead of snprintf in xwayland_spawner.cpp#4793
yotam-medini wants to merge 2 commits intocanonical:mainfrom
yotam-medini:stdfmt-4660-xwayland_spawner

Conversation

@yotam-medini
Copy link
Copy Markdown
Contributor

@yotam-medini yotam-medini commented Mar 23, 2026

May close #4660

Related: #4736

What's new?

use std::format or std::format_to_n instead of snprintf in xwayland_spawner.cpp

Save generated paths as XWaylandSpawner data members.
Introduce private XWaylandSpawner::XDisplayPaths struct.
Delegate public XWaylandSpawner ctor to private ctor via XDisplayPaths.
create_lockfile(), choose_display() are now static class methods.

How to test

Checklist

  • Tests added and pass
  • Adequate documentation added
  • (optional) Added Screenshots or videos

@yotam-medini yotam-medini requested a review from a team as a code owner March 23, 2026 18:12
@yotam-medini yotam-medini force-pushed the stdfmt-4660-xwayland_spawner branch from 5df7145 to f31b5f2 Compare March 23, 2026 18:27
@yotam-medini yotam-medini marked this pull request as draft March 26, 2026 20:36
@yotam-medini yotam-medini marked this pull request as ready for review March 27, 2026 06:24
@yotam-medini yotam-medini force-pushed the stdfmt-4660-xwayland_spawner branch from 7e6771d to a413c84 Compare March 30, 2026 17:35
Copy link
Copy Markdown
Contributor

@robert-ancell robert-ancell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvement!

@robert-ancell robert-ancell enabled auto-merge March 31, 2026 00:33
@robert-ancell robert-ancell disabled auto-merge March 31, 2026 01:47
@robert-ancell
Copy link
Copy Markdown
Contributor

@Saviq the CI seems to be stalled - any ideas why?

@RAOF RAOF enabled auto-merge March 31, 2026 01:52
@Saviq
Copy link
Copy Markdown
Contributor

Saviq commented Mar 31, 2026

@Saviq the CI seems to be stalled - any ideas why?

That'd be 136cefd7193aade370d7410a52f8e5aa76eb51ca…

But why is TiCS fine being skipped, and the others, not?

@Saviq Saviq disabled auto-merge March 31, 2026 06:48
@Saviq Saviq added this pull request to the merge queue Mar 31, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 31, 2026
create_socket(result, &addr, path_size);
auto name_create_socket = [&](char *bos, size_t limit)
{
auto eos = std::format_to_n(bos, limit, "{}", x11_socket).out;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TiCS has this to say:

narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'iter_difference_t<char *>' (aka 'long') is implementation-defined.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[How] can I run this TiCS locally ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, you can't, but that actually comes from clang-tidy. You should be able to reproduce this with the following CMake options:

-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_CLANG_TIDY=clang-tidy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use std::Format instead of char buffers

3 participants