# US 2021/0232368 A1 · Electronic apparatus and control method thereof

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0232368 A1
- Document ID: US20210232368A1
- Status: Published application
- Kind: A1
- Application number: 17/155,558
- Filed: 2021-01-22
- Published: 2021-07-29
- Earliest claimed: 2020-01-23
- Assignees: Samsung Electronics Co., Ltd.
- Applicants: Samsung Electronics Co., Ltd.
- Inventors: Sungbae YOO; Seolheui KIM
- Web page: https://patentgrep.com/patent/US20210232368A1

## CPC

- G06F 8/33: Intelligent editors
- G06F 8/51: Source to source
- G06F 8/434: {Pointers; Aliasing}
- G06F 9/44526: {Plug-ins; Add-ons}
- G06F 9/4484: {Executing subprograms}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

An electronic apparatus and a control method of the electronic apparatus is provided. The method includes acquiring source code written in a programing language, identifying a structure including a function pointer from the source code, identifying a plurality of initialized variables as a plurality first variables among variables of the function pointer included in the identified structure, and modifying the source code by changing an indirect call using an unmodifiable variable among the plurality of first variables to a direct call.

## Claims

### Claim 1

A control method of an electronic apparatus, the method comprising:
acquiring a source code written in a programing language;
identifying a structure including a function pointer from the acquired source code;
identifying a plurality of initialized variables including a portion where the function pointer is initialized among variables of the function pointer included in the identified structure; and
modifying the source code by changing an indirect call which uses an unmodifiable variable among the identified plurality of variables to a direct call.

### Claim 2 (depends on 1)

The control method of claim 1, wherein the plurality of initialized variables are a plurality of first variables, and the modifying further comprises identifying a modifiable second variable among the plurality of first variables, and
where the modifying of the source code by the changing of the indirect call which uses a third variable other than the modifiable second variable among the plurality of first variables to the direct call,
wherein the modifiable second variable is configured to comprise at least one of a variable to be reassigned or a variable transferred to a modifiable parameter.

### Claim 3 (depends on 2)

The control method of claim 2, wherein the third variable is a const type which is not modified.

### Claim 4 (depends on 1)

The control method of claim 1, wherein the control method is configured to further comprise changing the modified source code to a machine language.

### Claim 5 (depends on 1)

The control method of claim 1, wherein the source code does not include annotation.

### Claim 6 (depends on 1)

The control method of claim 1, wherein the source code is written in a language other than an object oriented programming language.

### Claim 7 (depends on 1)

The control method of claim 1, wherein the control method is configured to be implemented in a form of a plug-in in a compiler for a compilation operation.

### Claim 8 (depends on 1)

The control method of claim 1, wherein the control method is configured to be implemented in a form of a plug-in in a linker for compilation.

### Claim 9

An electronic apparatus comprising:
a memory configured to store at least one instruction; and
a processor configured to acquire source code written in a programming language by executing the instruction,
identify a structure including a function pointer from the acquired source code,
identify a plurality of initialized variables including a portion where the function pointer is initialized among variables of the function pointer included in the identified structure, and
modify the source code by changing an indirect call which uses an unmodifiable variable among the identified plurality of variables to a direct call.

### Claim 10 (depends on 9)

The electronic apparatus of claim 9, wherein the plurality of initialized variables are a plurality of first variables, and the processor is configured to identify a modifiable second variable among the plurality of first variables, and
where the modify of the source code by the changing of the indirect call which uses a third variable other than the modifiable second variable among the plurality of first variables to the direct call,
wherein the modifiable second variable is configured to comprise at least one of a variable to be reassigned or a variable transferred to a modifiable parameter.

### Claim 11 (depends on 10)

The electronic apparatus of claim 10, wherein the third variable is a const type which is not modified.

### Claim 12 (depends on 9)

The electronic apparatus of claim 9, wherein the processor is configured to change the modified source code to a machine language.

### Claim 13 (depends on 9)

The electronic apparatus of claim 9, wherein the source code does not include annotation.

### Claim 14 (depends on 9)

The electronic apparatus of claim 9, wherein the source code is written in a language other than an object oriented programming language.

### Claim 15 (depends on 9)

The electronic apparatus of claim 9, wherein the processor is configured to modify the source code in a form of a plug-in in a compiler for compilation.

### Claim 16 (depends on 9)

The electronic apparatus of claim 9, wherein the processor is configured to modify the source code in a form of the plug-in in a linker for compilation.
