From

    void foo() { 
      bar1(9); 
      bar2(9); 
    }

to 

    void foo() {
      foo_ex();
    }
    
    void foo_ex() {
      bar1(9);
      bar2(9); 
    }

is called [Extract Function][1], as [mentioned by Thomas Owens][2]. However, replacing the hardcoded value is not part of that refactoring. The step to

    void foo() {
      foo_ex(9);
    }
    
    void foo_ex(int x) {
      bar1(x);
      bar2(x); 
    }

is called [Parameterize Function][3]. It max be also seen as a special case of [Change Function Declaration][4].


  [1]: https://refactoring.com/catalog/extractFunction.html
  [2]: https://softwareengineering.stackexchange.com/a/439897
  [3]: https://refactoring.com/catalog/parameterizeFunction.html
  [4]: https://refactoring.com/catalog/changeFunctionDeclaration.html