lang: Use static qualifiers for internal functions and data
This commit is contained in:
parent
14eff6a33b
commit
3fcf44ff63
1 changed files with 6 additions and 5 deletions
|
@ -6,7 +6,7 @@
|
|||
#include "stdio.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
struct object_class num_class;
|
||||
static struct object_class num_class;
|
||||
|
||||
struct number {
|
||||
struct object obj;
|
||||
|
@ -22,7 +22,7 @@ struct object *number_create(int value) {
|
|||
return (struct object *)num;
|
||||
}
|
||||
|
||||
void number_cleanup(struct object *obj) {
|
||||
static void number_cleanup(struct object *obj) {
|
||||
abort_if(obj->class_data != &num_class,
|
||||
"number_cleanup obj is not a number");
|
||||
struct number *num = (struct number *)obj;
|
||||
|
@ -36,7 +36,8 @@ int number_value(struct object *obj) {
|
|||
return num->value;
|
||||
}
|
||||
|
||||
void number_add(struct object *obj, int arg_count, struct object **args) {
|
||||
static void number_add(
|
||||
struct object *obj, int arg_count, struct object **args) {
|
||||
abort_if(arg_count != 1, "number_add called with more than 1 argument");
|
||||
abort_if(!args[0], "number_add arg is NULL");
|
||||
abort_if(obj->class_data != &num_class,
|
||||
|
@ -49,10 +50,10 @@ void number_add(struct object *obj, int arg_count, struct object **args) {
|
|||
args[0] = number_create(added);
|
||||
}
|
||||
|
||||
struct object_call calls[] = {
|
||||
static struct object_call calls[] = {
|
||||
{.name = "Add", .handler = number_add}, {.name = NULL, /* end */}};
|
||||
|
||||
struct object_class num_class = {
|
||||
static struct object_class num_class = {
|
||||
.cleanup = number_cleanup,
|
||||
.calls = &calls[0],
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue