Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7793541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:31:16+00:00 2026-06-01T22:31:16+00:00

I have a function like myFunction ( myStruct_1_Ptr *var1, /* commenty */ myStruct_2_Ptr *var2,

  • 0

I have a function like

myFunction (
  myStruct_1_Ptr *var1, /* commenty */
  myStruct_2_Ptr *var2, /* commenty */
  myStruct_3_Ptr *var3, /* commenty */
  int info1,
  int info2,
  int info3,
  int info4
)

Than I moved all those infos inside a wrapping struct and I want to make it look like

myFunction (
  myStruct_1_Ptr *var1, /* commenty */
  myStruct_2_Ptr *var2, /* commenty */
  myStruct_3_Ptr *var3, /* commenty */
  myStruct_4_Ptr *var4  /* This is where all infos went in */
)

The function is invoked by a similar syntax, by just removing the syntax in front.

myFunction (
  var1, /* commenty */
  var2, /* commenty */
  var3, /* commenty */
  var4  /* This is where all infos went in */
);

How can I do it with search and replace (or anything else)? I have written here only the declaration part that lives only in two places—in the corresponding .c and .h files, but I want to do it similarly with all the places I invoke the function. The variables’ names that are given to the function are all the same.

An alternative way to S&R could probably be to execute a macro on all instances of the function across multiple files, but I am unsure how to do that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:31:18+00:00Added an answer on June 1, 2026 at 10:31 pm

    If it’s a simple function call with no nested parens, then you can do it with a substitute command, something like this:

    :%s/\(myFunction\_s*(\(\_[^,]*,\)\{3}.*\_s*\)\_[^)]*/\1var4\r/
    

    then you can do that across all open buffers with :bufdo, but this is really specific and comes with tons of caveats about no nested brackets, no commas is comments and I’m sure tons of other cases where it won’t work right.

    The key is \_ which extends character classes and . to match newlines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function like this: MyFunction(double matrix[4][4]) {/*do stuff*/} I am calling this
I have some code like this: var content = document.getElementById('myDivId'); function MyFunction() { alert(content.style.height);
I have a function that is like this - var myFunction = function(arg1, arg2,
Suppose I have a function call from EF like: var result = context.myFunction(); the
I have a function which implement an interface. something like this: string IMyInterface.MyFunction() {
I have an interface like Public Shared Function myfunction(Byval myvar as string, Optional ByVal
I have a function declared as: int myFunction(const float** ppArr, const int n, const
i have a function like this: BOOL WINAPI MyFunction(HDC hdc, LPCWSTR text, UINT cbCount){
I have a function name stored in a variable like this: myvar = 'mypackage.mymodule.myfunction'
I have a function like this, that I would like to refactor function Myfunction(sUrl,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.