File path: /jruby-1.4.0/src/org/jruby/RubyProcess.java | File path: /jruby-1.4.0/src/org/jruby/RubyProcess.java | |||
Method name: IRubyObject waitpid(Ruby, IRubyObject[])
|
Method name: IRubyObject waitpid2(Ruby, IRubyObject[])
|
|||
Number of AST nodes: 12 | Number of AST nodes: 11 | |||
1 | int pid = -1;↵ | 1 | int pid = -1;↵ | |
2 | int flags = 0;↵ | 2 | int flags = 0;↵ | |
3 | if (args.length > 0) {↵ | 3 | if (args.length > 0) {↵ | |
4 | pid = (int)args[0].convertToInteger().getLongValue();↵ | 4 | pid = (int)args[0].convertToInteger().getLongValue();↵ | |
5 | }↵ | 5 | }↵ | |
6 | if (args.length > 1) {↵ | 6 | if (args.length > 1) {↵ | |
7 | flags = (int)args[1].convertToInteger().getLongValue();↵ | 7 | flags = (int)args[1].convertToInteger().getLongValue();↵ | |
8 | }↵ | 8 | }↵ | |
9 | ↵ | 9 | ↵ | |
10 | int[] status = new int[1];↵ | 10 | int[] status = new int[1];↵ | |
11 | pid = runtime.getPosix().waitpid(pid, status, flags);↵ | 11 | pid = runtime.getPosix().waitpid(pid, status, flags);↵ | |
12 | ↵ | 12 | ↵ | |
13 | if (pid == -1) {↵ | 13 | if (pid == -1) {↵ | |
14 | throw runtime.newErrnoECHILDError();↵ | 14 | throw runtime.newErrnoECHILDError();↵ | |
15 | }↵ | 15 | }↵ | |
16 | ↵ | 16 | ↵ | |
17 | runtime.getGlobalVariables().set(↵ | 17 | r↵ | |
18 | "$?", ↵ | |||
19 | RubyProcess.RubyStatus.newProcessStatus(runtime, status[0]));↵ | 18 | eturn runtime.newArray(runtime.newFixnum(pid), RubyProcess.RubyStatus.newProcessStatus(runtime, status[0])); | |
20 | return runtime.newFixnum(pid); | |||
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.6 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 57 |
Number of mapped statements | 11 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 2.9 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | int pid = -1; | 1 | int pid = -1; | ||||||||||||||||||
2 | int flags = 0; | 2 | int flags = 0; | ||||||||||||||||||
3 | if (args.length > 0) | 3 | if (args.length > 0) | ||||||||||||||||||
4 | pid = (int)args[0].convertToInteger().getLongValue(); | 4 | pid = (int)args[0].convertToInteger().getLongValue(); | ||||||||||||||||||
5 | if (args.length > 1) | 5 | if (args.length > 1) | ||||||||||||||||||
6 | flags = (int)args[1].convertToInteger().getLongValue(); | 6 | flags = (int)args[1].convertToInteger().getLongValue(); | ||||||||||||||||||
7 | int[] status = new int[1]; | 7 | int[] status = new int[1]; | ||||||||||||||||||
8 | pid = runtime.getPosix().waitpid(pid, status, flags); | 8 | pid = runtime.getPosix().waitpid(pid, status, flags); | ||||||||||||||||||
9 | if (pid == -1) | 9 | if (pid == -1) | ||||||||||||||||||
10 | throw runtime.newErrnoECHILDError(); | 10 | throw runtime.newErrnoECHILDError(); | ||||||||||||||||||
11 | runtime.getGlobalVariables().set("$?", RubyProcess.RubyStatus.newProcessStatus(runtime, status[0])); | | |||||||||||||||||||
12 | return runtime.newFixnum(pid); |
| 11 | return runtime.newArray(runtime.newFixnum(pid), RubyProcess.RubyStatus.newProcessStatus(runtime, status[0])); |
Row | Violation |
---|---|
1 | Expression runtime.newFixnum(pid) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression runtime.newArray(runtime.newFixnum(pid),RubyProcess.RubyStatus.newProcessStatus(runtime,status[0])) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression runtime.newFixnum(pid) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression runtime.newArray(runtime.newFixnum(pid),RubyProcess.RubyStatus.newProcessStatus(runtime,status[0])) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Clone fragment #1 returns variables status , while Clone fragment #2 returns variables |