mirror of
https://github.com/mbilker/vgpu_unlock-rs.git
synced 2025-06-08 13:28:23 +02:00
Move main macro body one indentation level out
This commit is contained in:
parent
4a73f9376d
commit
e121e65859
25
src/lib.rs
25
src/lib.rs
@ -314,8 +314,7 @@ fn apply_profile_override(config: &mut VgpuConfig) -> bool {
|
||||
let gpu_type = config.gpu_type;
|
||||
|
||||
macro_rules! handle_copy_overrides {
|
||||
($($field:ident),*$(,)?) => {
|
||||
$(
|
||||
($field:ident) => {
|
||||
if let Some(value) = config_override.$field {
|
||||
info!(
|
||||
"Patching nvidia-{}/{}: {} -> {}",
|
||||
@ -327,12 +326,15 @@ fn apply_profile_override(config: &mut VgpuConfig) -> bool {
|
||||
|
||||
config.$field = value;
|
||||
}
|
||||
};
|
||||
($($field:ident),*$(,)?) => {
|
||||
$(
|
||||
handle_copy_overrides!($field);
|
||||
)*
|
||||
};
|
||||
}
|
||||
macro_rules! handle_str_overrides {
|
||||
($($field:ident),*$(,)?) => {
|
||||
$(
|
||||
($field:ident) => {
|
||||
if let Some(value) = config_override.$field {
|
||||
let value_bytes = value.as_bytes();
|
||||
|
||||
@ -355,20 +357,23 @@ fn apply_profile_override(config: &mut VgpuConfig) -> bool {
|
||||
value
|
||||
);
|
||||
|
||||
// Zero out the field first
|
||||
// Zero out the field first.
|
||||
config.$field.fill(0);
|
||||
|
||||
// Write the string bytes.
|
||||
let _ = config.$field[..].as_mut().write_all(value_bytes);
|
||||
}
|
||||
}
|
||||
};
|
||||
($($field:ident),*$(,)?) => {
|
||||
$(
|
||||
handle_str_overrides!($field);
|
||||
)*
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* While the following could be done with two statements. I wanted the log statements to be in
|
||||
* field order.
|
||||
*/
|
||||
// While the following could be done with two statements. I wanted the log statements to be in
|
||||
// field order.
|
||||
|
||||
handle_copy_overrides! {
|
||||
gpu_type,
|
||||
|
Loading…
x
Reference in New Issue
Block a user