Alexander Wilms
|
73019c204d
|
Replace redundant types with auto for the lvalues of template factory functions for smart pointers
grep -r --include \*.h --include \*.cpp "= std::" * | grep -v auto | grep -Po ".*[^ ]+ [^ ]+ [^ ]*[ ]*=.*;" | grep -v "auto\|int\|char\|bool\|float|\double\|for\|if\|googletest\|fuzzylite\|size_t\|using\|return" | grep -v double | grep -v si64 | grep -v si32 | grep -v ui32 | grep \< | grep -v float | tr -d '\t' | grep -v assert > redundant_types.txt
import re
with open("redundant_types.txt") as f:
for line in f:
line = line.strip()
path = line.split(":", 1)[0]
original_code = ":".join(line.split(":")[1:]).strip()
print()
print(path)
print(original_code)
prefix = "auto "
if original_code.startswith("static"):
static = True
else:
static = False
cpp_type = " ".join(original_code.split("=")[0].strip().split(" ")[0:-1])
print(cpp_type)
if static:
new_code = "static auto "+ " ".join(original_code.split(" ")[2:])
else:
new_code = "auto "+ " ".join(original_code.split(" ")[1:])
print(new_code)
if True:
with open(path, "r") as f:
filedata = f.read()
filedata = filedata.replace(original_code, new_code)
with open(path, "w") as f:
f.write(filedata)
|
2024-01-17 12:50:00 +00:00 |
|
Laserlicht
|
9299eaed36
|
code review
|
2023-12-16 21:10:27 +01:00 |
|
Laserlicht
|
56562ad8dc
|
date time format
|
2023-12-16 18:57:38 +01:00 |
|
Ivan Savenko
|
5c810df36f
|
Reorganized types registration code
|
2023-11-11 00:39:08 +02:00 |
|
Laserlicht
|
e03f2a9d3a
|
improvements for non quadratic maps
|
2023-10-21 16:49:50 +02:00 |
|
Laserlicht
|
abab917ef9
|
fix crash with custom campaign preview
|
2023-10-11 11:23:38 +02:00 |
|
Laserlicht
|
12ca3ea0ec
|
pos from texture
|
2023-10-01 19:44:04 +02:00 |
|
Laserlicht
|
cbd014ac88
|
code review
|
2023-10-01 17:35:56 +02:00 |
|
Laserlicht
|
23b8a321f6
|
file ending
|
2023-10-01 00:46:29 +02:00 |
|
Laserlicht
|
648a37310f
|
description
|
2023-10-01 00:35:11 +02:00 |
|
Laserlicht
|
65c21064b5
|
added var
|
2023-10-01 00:18:25 +02:00 |
|
Laserlicht
|
58dfc55ca3
|
only calc minimaps once
|
2023-09-30 23:50:27 +02:00 |
|
Laserlicht
|
61aae7bccc
|
code review
|
2023-09-30 22:49:22 +02:00 |
|
Laserlicht
|
8b835c9253
|
load game support
|
2023-09-30 20:03:33 +02:00 |
|
Laserlicht
|
c6adcc40f5
|
add date; cleanup
|
2023-09-30 17:56:51 +02:00 |
|
Laserlicht
|
79e66c38df
|
layout
|
2023-09-30 17:14:22 +02:00 |
|
Laserlicht
|
718bafc8af
|
map overview rework
|
2023-09-30 15:05:12 +02:00 |
|