Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Enchente
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vytor Calixto
Enchente
Commits
3f365fe9
Commit
3f365fe9
authored
8 years ago
by
Vytor Calixto
Browse files
Options
Downloads
Patches
Plain Diff
Muda retorno int para bool
parent
eb59c78c
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
libs/lista.c
+6
-5
6 additions, 5 deletions
libs/lista.c
libs/lista.h
+7
-6
7 additions, 6 deletions
libs/lista.h
libs/vertice.c
+2
-2
2 additions, 2 deletions
libs/vertice.c
libs/vertice.h
+1
-1
1 addition, 1 deletion
libs/vertice.h
with
16 additions
and
14 deletions
libs/lista.c
+
6
−
5
View file @
3f365fe9
#include
<malloc.h>
#include
<stdbool.h>
#include
"lista.h"
#include
"no.h"
//---------------------------------------------------------------------------
...
...
@@ -51,10 +52,10 @@ Lista constroiLista(void) {
// devolve 1 em caso de sucesso,
// ou 0 em caso de falha
int
destroiLista
(
Lista
l
,
int
destroi
(
void
*
))
{
bool
destroiLista
(
Lista
l
,
bool
destroi
(
void
*
))
{
No
p
;
int
ok
=
1
;
bool
ok
=
true
;
while
(
(
p
=
primeiroNoLista
(
l
))
)
{
...
...
@@ -132,8 +133,8 @@ No insereUnicoLista(void *conteudo, Lista l) {
// devolve 1, em caso de sucesso
// 0, se rNo não for um No de l
int
removeNo
(
struct
Lista
*
l
,
struct
No
*
rNo
,
int
destroi
(
void
*
))
{
int
r
=
1
;
bool
removeNo
(
struct
Lista
*
l
,
struct
No
*
rNo
,
bool
destroi
(
void
*
))
{
bool
r
=
true
;
if
(
l
->
primeiro
==
rNo
)
{
l
->
primeiro
=
getSucessorNo
(
rNo
);
if
(
destroi
!=
NULL
)
{
...
...
@@ -154,5 +155,5 @@ int removeNo(struct Lista *l, struct No *rNo, int destroi(void *)) {
return
r
;
}
}
return
0
;
return
false
;
}
This diff is collapsed.
Click to expand it.
libs/lista.h
+
7
−
6
View file @
3f365fe9
#ifndef _LISTA_
#define _LISTA_
#include
"no.h"
#include
<stdbool.h>
//-----------------------------------------------------------------------------
// (apontador para) Lista encadeada
...
...
@@ -49,16 +50,16 @@ Lista constroiLista(void);
//
// para cada nó n da Lista.
//
// devolve
1
em caso de sucesso,
// ou
0
em caso de falha
// devolve
true
em caso de sucesso,
// ou
false
em caso de falha
int
destroiLista
(
Lista
l
,
int
destroi
(
void
*
));
bool
destroiLista
(
Lista
l
,
bool
destroi
(
void
*
));
//------------------------------------------------------------------------------
// remove o No de endereço rNo de l
// se destroi != NULL, executa destroi(conteudo(rNo))
// devolve
1
, em caso de sucesso
//
0
, se rNo não for um No de l
// devolve
true
, em caso de sucesso
//
false
, se rNo não for um No de l
int
removeNoLista
(
struct
Lista
*
l
,
struct
No
*
rNo
,
int
destroi
(
void
*
));
bool
removeNoLista
(
struct
Lista
*
l
,
struct
No
*
rNo
,
bool
destroi
(
void
*
));
#endif
This diff is collapsed.
Click to expand it.
libs/vertice.c
+
2
−
2
View file @
3f365fe9
...
...
@@ -15,12 +15,12 @@ Vertice criaVertice() {
return
v
;
}
int
destroiVertice
(
void
*
v
)
{
bool
destroiVertice
(
void
*
v
)
{
Vertice
w
=
(
Vertice
)
v
;
// Como os outros vértices também estão no grafo, deixamos isso a cargo dele
destroiLista
(
w
->
pais
,
NULL
);
destroiLista
(
w
->
filhos
,
NULL
);
free
(
w
);
w
=
NULL
;
return
1
;
return
true
;
}
This diff is collapsed.
Click to expand it.
libs/vertice.h
+
1
−
1
View file @
3f365fe9
...
...
@@ -16,6 +16,6 @@ typedef struct Vertice *Vertice;
Vertice
criaVertice
();
int
destroiVertice
(
void
*
v
);
bool
destroiVertice
(
void
*
v
);
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment