Skip to content

Commit

Permalink
Restore simple arrays and avoid mallocs.
Browse files Browse the repository at this point in the history
  • Loading branch information
gijsbers committed Nov 10, 2024
1 parent 9fa96c8 commit e6ee573
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/apppstatus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ void NetStatusControl::linuxUpdate() {
}

int const count(fNetStatus.getCount());
asmart<bool> covered(new bool[count]);
bool covered[count];
for (int i = 0; i < count; ++i) {
covered[i] = (nullptr == fNetStatus[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/wmdock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void DockApp::proper() {
if (intern) {
const int count = docks.getCount();
if (count) {
asmart<Atom> atoms(new Atom[count]);
Atom atoms[count];
for (int i = 0; i < count; ++i) {
atoms[i] = Atom(docks[i].client->handle());
}
Expand Down
2 changes: 1 addition & 1 deletion src/wmmgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3079,7 +3079,7 @@ void YWindowManager::setDesktopCount() {
void YWindowManager::setDesktopViewport() {
MSG(("setting: _NET_DESKTOP_VIEWPORT"));
const int n = 2 * workspaceCount;
asmart<Atom> data(new Atom[n]);
Atom data[n];
for (int i = 0; i < n; ++i)
data[i] = 0;
setProperty(_XA_NET_DESKTOP_VIEWPORT, XA_CARDINAL, data, n);
Expand Down
2 changes: 1 addition & 1 deletion src/wmpref.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ PrefsMenu::PrefsMenu() :
addSubmenu("S_calar", -2, sc = new YMenu, "key");
addSubmenu("St_ring", -2, st = new YMenu, "key");

asmart<int> index(new int[count]);
int index[count];
for (int i = 0; i < count; ++i) {
index[i] = i;
}
Expand Down
2 changes: 1 addition & 1 deletion src/yxtray.cc
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ void YXTray::trayUpdateGeometry(unsigned w, unsigned h, bool visible) {

void YXTray::updateTrayWindows() {
const int count = fDocked.getCount();
asmart<Window> windows(new Window[count]);
Window windows[count];

for (IterType ec = fDocked.iterator(); ++ec; )
windows[ec.where()] = ec->leader();
Expand Down

0 comments on commit e6ee573

Please sign in to comment.